本文整理汇总了Java中org.codehaus.groovy.ast.ClassHelper.DYNAMIC_TYPE属性的典型用法代码示例。如果您正苦于以下问题:Java ClassHelper.DYNAMIC_TYPE属性的具体用法?Java ClassHelper.DYNAMIC_TYPE怎么用?Java ClassHelper.DYNAMIC_TYPE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.codehaus.groovy.ast.ClassHelper
的用法示例。
在下文中一共展示了ClassHelper.DYNAMIC_TYPE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeType
protected ClassNode makeType(AST typeNode) {
ClassNode answer = ClassHelper.DYNAMIC_TYPE;
AST node = typeNode.getFirstChild();
if (node != null) {
if (isType(INDEX_OP, node) || isType(ARRAY_DECLARATOR, node)) {
answer = makeType(node).makeArray();
} else {
checkTypeArgs(node, false);
answer = ClassHelper.make(qualifiedName(node));
if (answer.isUsingGenerics()) {
ClassNode newAnswer = ClassHelper.makeWithoutCaching(answer.getName());
newAnswer.setRedirect(answer);
answer = newAnswer;
}
}
configureAST(answer, node);
}
return answer;
}
示例2: visitCatchStatement
public void visitCatchStatement(CatchStatement cs) {
resolveOrFail(cs.getExceptionType(), cs);
if (cs.getExceptionType() == ClassHelper.DYNAMIC_TYPE) {
cs.getVariable().setType(ClassHelper.make(Exception.class));
}
super.visitCatchStatement(cs);
}
示例3: rewriteReferenceStatement
private MethodCallExpression rewriteReferenceStatement(String path) {
referencedPaths.add(path);
Parameter it = new Parameter(ClassHelper.DYNAMIC_TYPE, "it");
it.setOriginType(ClassHelper.OBJECT_TYPE);
VariableExpression subject = new VariableExpression(it);
ArgumentListExpression arguments = new ArgumentListExpression(new ConstantExpression(path));
return new MethodCallExpression(subject, "getAt", arguments);
}
示例4: VariableExpression
public VariableExpression(String variable) {
this(variable, ClassHelper.DYNAMIC_TYPE);
}
示例5: setType
public void setType(ClassNode type) {
this.type = type;
dynamicTyped |= type==ClassHelper.DYNAMIC_TYPE;
}
示例6: setType
/**
* Set the type of this variable. If you call this method from an AST transformation and that
* the {@link #getAccessedVariable() accessed variable} is ({@link #isClosureSharedVariable() shared},
* this operation is unsafe and may lead to a verify error at compile time. Instead, set the type of
* the {@link #getAccessedVariable() accessed variable}
* @param cn the type to be set on this variable
*/
public void setType(ClassNode cn){
super.setType(cn);
isDynamicTyped |= ClassHelper.DYNAMIC_TYPE==cn;
}