Class ClassNode
- java.lang.Object
- 
- org.codehaus.groovy.ast.ASTNode
- 
- org.codehaus.groovy.ast.AnnotatedNode
- 
- org.codehaus.groovy.ast.ClassNode
 
 
 
- 
- All Implemented Interfaces:
- org.objectweb.asm.Opcodes
 - Direct Known Subclasses:
- CompileUnit.ConstructedOuterNestedClassNode,- DecompiledClassNode,- InnerClassNode,- MixinNode,- WideningCategories.LowestUpperBoundClassNode
 
 public class ClassNode extends AnnotatedNode implements org.objectweb.asm.Opcodes Represents a class in the AST.A ClassNode should be created using the methods in ClassHelper. This ClassNode may be used to represent a class declaration or any other type. This class uses a proxy mechanism allowing to create a class for a plain name at AST creation time. In another phase of the compiler the real ClassNode for the plain name may be found. To avoid the need of exchanging this ClassNode with an instance of the correct ClassNode the correct ClassNode is set as redirect. Most method calls are then redirected to that ClassNode. There are three types of ClassNodes: -  Primary ClassNodes:
 A primary ClassNode is one where we have a source representation which is to be compiled by Groovy and which we have an AST for. The groovy compiler will output one class for each such ClassNode that passes through AsmBytecodeGenerator... not more, not less. That means for example Closures become such ClassNodes too at some point.
-  ClassNodes create through different sources (typically created
 from a java.lang.reflect.Class object):
 The compiler will not output classes from these, the methods usually do not contain bodies. These kind of ClassNodes will be used in different checks, but not checks that work on the method bodies. For example if such a ClassNode is a super class to a primary ClassNode, then the abstract method test and others will be done with data based on these. Theoretically it is also possible to mix both (1 and 2) kind of classes in a hierarchy, but this probably works only in the newest Groovy versions. Such ClassNodes normally have to isResolved() returning true without having a redirect.In the Groovy compiler the only version of this, that exists, is a ClassNode created through a Class instance
-  Labels:
 ClassNodes created through ClassHelper.makeWithoutCaching. They are place holders, its redirect points to the real structure, which can be a label too, but following all redirects it should end with a ClassNode from one of the other two categories. If ResolveVisitor finds such a node, it tries to set the redirects. Any such label created after ResolveVisitor has done its work needs to have a redirect pointing to case 1 or 2. If not the compiler may react strange... this can be considered as a kind of dangling pointer.
 To describe generic type signature see getGenericsTypes()andsetGenericsTypes(GenericsType[]). These methods are not proxied, they describe the type signature used at the point of declaration or the type signatures provided by the class. If the type signatures provided by the class are needed, then a call toredirect()will help.- See Also:
- ClassHelper
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.lang.Classclazzstatic ClassNode[]EMPTY_ARRAYprotected java.util.List<InnerClassNode>innerClassesprotected booleanisPrimaryNodeprotected java.lang.ObjectlazyInitLockstatic ClassNodeSUPERstatic ClassNodeTHIS- 
Fields inherited from interface org.objectweb.asm.OpcodesAALOAD, AASTORE, ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_DEPRECATED, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_MANDATED, ACC_MODULE, ACC_NATIVE, ACC_OPEN, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_RECORD, ACC_STATIC, ACC_STATIC_PHASE, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_TRANSITIVE, ACC_VARARGS, ACC_VOLATILE, ACONST_NULL, ALOAD, ANEWARRAY, ARETURN, ARRAYLENGTH, ASM10_EXPERIMENTAL, ASM4, ASM5, ASM6, ASM7, ASM8, ASM9, ASTORE, ATHROW, BALOAD, BASTORE, BIPUSH, CALOAD, CASTORE, CHECKCAST, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DLOAD, DMUL, DNEG, DOUBLE, DREM, DRETURN, DSTORE, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F_APPEND, F_CHOP, F_FULL, F_NEW, F_SAME, F_SAME1, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FLOAT, FMUL, FNEG, FREM, FRETURN, FSTORE, FSUB, GETFIELD, GETSTATIC, GOTO, H_GETFIELD, H_GETSTATIC, H_INVOKEINTERFACE, H_INVOKESPECIAL, H_INVOKESTATIC, H_INVOKEVIRTUAL, H_NEWINVOKESPECIAL, H_PUTFIELD, H_PUTSTATIC, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, IF_ACMPEQ, IF_ACMPNE, IF_ICMPEQ, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ICMPLT, IF_ICMPNE, IFEQ, IFGE, IFGT, IFLE, IFLT, IFNE, IFNONNULL, IFNULL, IINC, ILOAD, IMUL, INEG, INSTANCEOF, INTEGER, INVOKEDYNAMIC, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISUB, IUSHR, IXOR, JSR, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDC, LDIV, LLOAD, LMUL, LNEG, LONG, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, NULL, POP, POP2, PUTFIELD, PUTSTATIC, RET, RETURN, SALOAD, SASTORE, SIPUSH, SOURCE_DEPRECATED, SOURCE_MASK, SWAP, T_BOOLEAN, T_BYTE, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_LONG, T_SHORT, TABLESWITCH, TOP, UNINITIALIZED_THIS, V_PREVIEW, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V10, V11, V12, V13, V14, V15, V16, V17, V18, V19, V20, V21, V9
 
- 
 - 
Constructor SummaryConstructors Constructor Description ClassNode(java.lang.Class c)Creates a non-primaryClassNodefrom a real class.ClassNode(java.lang.String name, int modifiers, ClassNode superClass)ClassNode(java.lang.String name, int modifiers, ClassNode superClass, ClassNode[] interfaces, MixinNode[] mixins)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ConstructorNodeaddConstructor(int modifiers, Parameter[] parameters, ClassNode[] exceptions, Statement code)voidaddConstructor(ConstructorNode node)FieldNodeaddField(java.lang.String name, int modifiers, ClassNode type, Expression initialValue)voidaddField(FieldNode node)FieldNodeaddFieldFirst(java.lang.String name, int modifiers, ClassNode type, Expression initialValue)voidaddFieldFirst(FieldNode node)voidaddInterface(ClassNode type)MethodNodeaddMethod(java.lang.String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code)If a method with the given name and parameters is already defined then it is returned otherwise the given method is added to this node.voidaddMethod(MethodNode node)voidaddMixin(MixinNode mixin)voidaddObjectInitializerStatements(Statement statements)Adds a statement to the object initializer.PropertyNodeaddProperty(java.lang.String name, int modifiers, ClassNode type, Expression initialValueExpression, Statement getterBlock, Statement setterBlock)voidaddProperty(PropertyNode node)voidaddStaticInitializerStatements(java.util.List<Statement> staticStatements, boolean fieldInit)MethodNodeaddSyntheticMethod(java.lang.String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code)Adds a synthetic method as part of the compilation process.voidaddTransform(java.lang.Class<? extends ASTTransformation> transform, ASTNode node)GenericsTypeasGenericsType()booleandeclaresInterface(ClassNode classNode)booleanequals(java.lang.Object that)java.util.List<MethodNode>getAbstractMethods()java.util.List<MethodNode>getAllDeclaredMethods()java.util.Set<ClassNode>getAllInterfaces()java.util.List<AnnotationNode>getAnnotations()java.util.List<AnnotationNode>getAnnotations(ClassNode type)CompileUnitgetCompileUnit()ClassNodegetComponentType()ConstructorNodegetDeclaredConstructor(Parameter[] parameters)java.util.List<ConstructorNode>getDeclaredConstructors()FieldNodegetDeclaredField(java.lang.String name)Finds a field matching the given name in this class.MethodNodegetDeclaredMethod(java.lang.String name, Parameter[] parameters)Finds a method matching the given name and parameters in this class.java.util.List<MethodNode>getDeclaredMethods(java.lang.String name)This methods returns a list of all methods of the given name defined in the current classjava.util.Map<java.lang.String,MethodNode>getDeclaredMethodsMap()MethodNodegetEnclosingMethod()FieldNodegetField(java.lang.String name)Finds a field matching the given name in this class or a parent class.java.util.Map<java.lang.String,FieldNode>getFieldIndex()java.util.List<FieldNode>getFields()GenericsType[]getGenericsTypes()MethodNodegetGetterMethod(java.lang.String getterName)MethodNodegetGetterMethod(java.lang.String getterName, boolean searchSuperClasses)java.util.Iterator<InnerClassNode>getInnerClasses()ClassNode[]getInterfaces()MethodNodegetMethod(java.lang.String name, Parameter[] parameters)Finds a method matching the given name and parameters in this class or any parent class.java.util.List<MethodNode>getMethods()java.util.List<MethodNode>getMethods(java.lang.String name)This methods creates a list of all methods with this name of the current class and of all super classesMixinNode[]getMixins()intgetModifiers()ModuleNodegetModule()java.lang.StringgetName()java.lang.StringgetNameWithoutPackage()java.util.List<Statement>getObjectInitializerStatements()ClassNodegetOuterClass()java.util.List<ClassNode>getOuterClasses()FieldNodegetOuterField(java.lang.String name)PackageNodegetPackage()java.lang.StringgetPackageName()ClassNodegetPlainNodeReference()java.util.List<PropertyNode>getProperties()PropertyNodegetProperty(java.lang.String name)MethodNodegetSetterMethod(java.lang.String setterName)MethodNodegetSetterMethod(java.lang.String setterName, boolean voidOnly)ClassNodegetSuperClass()java.lang.StringgetText()java.util.Map<java.lang.Class<? extends ASTTransformation>,java.util.Set<ASTNode>>getTransforms(CompilePhase phase)java.lang.ClassgetTypeClass()Returns the concrete class this classnode relates to.ClassNode[]getUnresolvedInterfaces()ClassNode[]getUnresolvedInterfaces(boolean useRedirect)java.lang.StringgetUnresolvedName()ClassNodegetUnresolvedSuperClass()ClassNodegetUnresolvedSuperClass(boolean useRedirect)booleanhasDeclaredMethod(java.lang.String name, Parameter[] parameters)inthashCode()booleanhasMethod(java.lang.String name, Parameter[] parameters)booleanhasPackageName()booleanhasPossibleMethod(java.lang.String name, Expression arguments)Determines if the type has a possibly-matching instance method with the given name and arguments.booleanhasPossibleStaticMethod(java.lang.String name, Expression arguments)Checks if the given method has a possibly matching static method with the given name and arguments.booleanhasProperty(java.lang.String name)booleanimplementsInterface(ClassNode classNode)booleanisAbstract()booleanisAnnotated()booleanisAnnotationDefinition()booleanisArray()booleanisDerivedFrom(ClassNode type)booleanisDerivedFromGroovyObject()booleanisEnum()booleanisGenericsPlaceHolder()booleanisInterface()booleanisPrimaryClassNode()booleanisRedirectNode()booleanisResolved()booleanisScript()booleanisScriptBody()booleanisStaticClass()Is this class declared in a static method (such as a closure / inner class declared in a static method)booleanisSyntheticPublic()Indicates that this class has been "promoted" to public by Groovy when in fact there was no public modifier explicitly in the source code.booleanisUsingGenerics()ClassNodemakeArray()Returns aClassNoderepresenting an array of the type represented by this.protected booleanparametersEqual(Parameter[] a, Parameter[] b)Deprecated.voidpositionStmtsAfterEnumInitStmts(java.util.List<Statement> staticFieldStatements)ClassNoderedirect()Returns theClassNodethis node is a proxy for or the node itself.voidremoveConstructor(ConstructorNode node)voidremoveField(java.lang.String oldName)voidremoveMethod(MethodNode node)voidrenameField(java.lang.String oldName, java.lang.String newName)voidsetAnnotated(boolean flag)Marks if the current class uses annotations or not.protected voidsetCompileUnit(CompileUnit cu)voidsetEnclosingMethod(MethodNode enclosingMethod)voidsetGenericsPlaceHolder(boolean b)voidsetGenericsTypes(GenericsType[] genericsTypes)voidsetInterfaces(ClassNode[] interfaces)voidsetModifiers(int modifiers)voidsetModule(ModuleNode module)java.lang.StringsetName(java.lang.String name)voidsetRedirect(ClassNode cn)Sets this instance as proxy for the givenClassNode.voidsetScript(boolean script)voidsetScriptBody(boolean scriptBody)voidsetStaticClass(boolean staticClass)voidsetSuperClass(ClassNode superClass)Sets the superclass of thisClassNode.voidsetSyntheticPublic(boolean syntheticPublic)voidsetUnresolvedSuperClass(ClassNode sn)voidsetUsingGenerics(boolean b)java.lang.StringtoString()java.lang.StringtoString(boolean showRedirect)MethodNodetryFindPossibleMethod(java.lang.String name, Expression arguments)voidvisitContents(GroovyClassVisitor visitor)- 
Methods inherited from class org.codehaus.groovy.ast.AnnotatedNodeaddAnnotation, addAnnotations, getDeclaringClass, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic
 - 
Methods inherited from class org.codehaus.groovy.ast.ASTNodecopyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getNodeMetaData, getNodeMetaData, putNodeMetaData, removeNodeMetaData, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setNodeMetaData, setSourcePosition, visit
 
- 
 
- 
- 
- 
Field Detail- 
EMPTY_ARRAYpublic static final ClassNode[] EMPTY_ARRAY 
 - 
THISpublic static final ClassNode THIS 
 - 
SUPERpublic static final ClassNode SUPER 
 - 
isPrimaryNodeprotected boolean isPrimaryNode 
 - 
innerClassesprotected java.util.List<InnerClassNode> innerClasses 
 - 
lazyInitLockprotected final java.lang.Object lazyInitLock 
 - 
clazzprotected java.lang.Class clazz 
 
- 
 - 
Constructor Detail- 
ClassNodepublic ClassNode(java.lang.Class c) Creates a non-primaryClassNodefrom a real class.
 - 
ClassNodepublic ClassNode(java.lang.String name, int modifiers, ClassNode superClass)- Parameters:
- name- the fully-qualified name of the class
- modifiers- the modifiers; see- Opcodes
- superClass- the base class; use "java.lang.Object" if no direct base class
 
 - 
ClassNodepublic ClassNode(java.lang.String name, int modifiers, ClassNode superClass, ClassNode[] interfaces, MixinNode[] mixins)- Parameters:
- name- the fully-qualified name of the class
- modifiers- the modifiers; see- Opcodes
- superClass- the base class; use "java.lang.Object" if no direct base class
- interfaces- the interfaces for this class
- mixins- the mixins for this class
- See Also:
- Opcodes
 
 
- 
 - 
Method Detail- 
redirectpublic ClassNode redirect() Returns theClassNodethis node is a proxy for or the node itself.
 - 
isRedirectNodepublic boolean isRedirectNode() 
 - 
setRedirectpublic void setRedirect(ClassNode cn) Sets this instance as proxy for the givenClassNode.- Parameters:
- node- the class to redirect to; if- nullthe redirect is removed
 
 - 
makeArraypublic ClassNode makeArray() Returns aClassNoderepresenting an array of the type represented by this.
 - 
isPrimaryClassNodepublic boolean isPrimaryClassNode() - Returns:
- trueif this instance is a primary- ClassNode
 
 - 
getEnclosingMethodpublic MethodNode getEnclosingMethod() 
 - 
setEnclosingMethodpublic void setEnclosingMethod(MethodNode enclosingMethod) 
 - 
isSyntheticPublicpublic boolean isSyntheticPublic() Indicates that this class has been "promoted" to public by Groovy when in fact there was no public modifier explicitly in the source code. That is, it remembers that it has applied Groovy's "public classes by default" rule. This property is typically only of interest to AST transform writers.- Returns:
- trueif node is public but had no explicit public modifier
 
 - 
setSyntheticPublicpublic void setSyntheticPublic(boolean syntheticPublic) 
 - 
setSuperClasspublic void setSuperClass(ClassNode superClass) Sets the superclass of thisClassNode.
 - 
getFieldspublic java.util.List<FieldNode> getFields() - Returns:
- the fields associated with this ClassNode
 
 - 
getInterfacespublic ClassNode[] getInterfaces() - Returns:
- the array of interfaces which this ClassNode implements
 
 - 
setInterfacespublic void setInterfaces(ClassNode[] interfaces) 
 - 
getMixinspublic MixinNode[] getMixins() - Returns:
- the mixins associated with this ClassNode
 
 - 
getMethodspublic java.util.List<MethodNode> getMethods() - Returns:
- the methods associated with this ClassNode
 
 - 
getAbstractMethodspublic java.util.List<MethodNode> getAbstractMethods() - Returns:
- the abstract methods associated with this ClassNode
 
 - 
getAllDeclaredMethodspublic java.util.List<MethodNode> getAllDeclaredMethods() 
 - 
getAllInterfacespublic java.util.Set<ClassNode> getAllInterfaces() 
 - 
getDeclaredMethodsMappublic java.util.Map<java.lang.String,MethodNode> getDeclaredMethodsMap() 
 - 
getNamepublic java.lang.String getName() 
 - 
getUnresolvedNamepublic java.lang.String getUnresolvedName() 
 - 
setNamepublic java.lang.String setName(java.lang.String name) 
 - 
getModifierspublic int getModifiers() 
 - 
setModifierspublic void setModifiers(int modifiers) 
 - 
getPropertiespublic java.util.List<PropertyNode> getProperties() 
 - 
getDeclaredConstructorspublic java.util.List<ConstructorNode> getDeclaredConstructors() 
 - 
getDeclaredConstructorpublic ConstructorNode getDeclaredConstructor(Parameter[] parameters) - Returns:
- the constructor matching the given parameters or null
 
 - 
removeConstructorpublic void removeConstructor(ConstructorNode node) 
 - 
getModulepublic ModuleNode getModule() 
 - 
getPackagepublic PackageNode getPackage() 
 - 
setModulepublic void setModule(ModuleNode module) 
 - 
addFieldpublic void addField(FieldNode node) 
 - 
addFieldFirstpublic void addFieldFirst(FieldNode node) 
 - 
getFieldIndexpublic java.util.Map<java.lang.String,FieldNode> getFieldIndex() 
 - 
addPropertypublic void addProperty(PropertyNode node) 
 - 
addPropertypublic PropertyNode addProperty(java.lang.String name, int modifiers, ClassNode type, Expression initialValueExpression, Statement getterBlock, Statement setterBlock) 
 - 
hasPropertypublic boolean hasProperty(java.lang.String name) 
 - 
getPropertypublic PropertyNode getProperty(java.lang.String name) 
 - 
addConstructorpublic void addConstructor(ConstructorNode node) 
 - 
addConstructorpublic ConstructorNode addConstructor(int modifiers, Parameter[] parameters, ClassNode[] exceptions, Statement code) 
 - 
addMethodpublic void addMethod(MethodNode node) 
 - 
removeMethodpublic void removeMethod(MethodNode node) 
 - 
addMethodpublic MethodNode addMethod(java.lang.String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code) If a method with the given name and parameters is already defined then it is returned otherwise the given method is added to this node. This method is useful for default method adding like getProperty() or invokeMethod() where there may already be a method defined in a class and so the default implementations should not be added if already present.
 - 
hasDeclaredMethodpublic boolean hasDeclaredMethod(java.lang.String name, Parameter[] parameters)- See Also:
- getDeclaredMethod(String, Parameter[])
 
 - 
hasMethodpublic boolean hasMethod(java.lang.String name, Parameter[] parameters)- See Also:
- getMethod(String, Parameter[])
 
 - 
addSyntheticMethodpublic MethodNode addSyntheticMethod(java.lang.String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code) Adds a synthetic method as part of the compilation process.
 - 
addFieldpublic FieldNode addField(java.lang.String name, int modifiers, ClassNode type, Expression initialValue) 
 - 
addFieldFirstpublic FieldNode addFieldFirst(java.lang.String name, int modifiers, ClassNode type, Expression initialValue) 
 - 
addInterfacepublic void addInterface(ClassNode type) 
 - 
equalspublic boolean equals(java.lang.Object that) - Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
addMixinpublic void addMixin(MixinNode mixin) 
 - 
getDeclaredFieldpublic FieldNode getDeclaredField(java.lang.String name) Finds a field matching the given name in this class.- Parameters:
- name- the name of the field of interest
- Returns:
- the method matching the given name and parameters or null
 
 - 
getFieldpublic FieldNode getField(java.lang.String name) Finds a field matching the given name in this class or a parent class.- Parameters:
- name- the name of the field of interest
- Returns:
- the method matching the given name and parameters or null
 
 - 
getOuterFieldpublic FieldNode getOuterField(java.lang.String name) - Returns:
- the field on the outer class or nullif this is not an inner class
 
 - 
getOuterClasspublic ClassNode getOuterClass() 
 - 
getOuterClassespublic java.util.List<ClassNode> getOuterClasses() 
 - 
addObjectInitializerStatementspublic void addObjectInitializerStatements(Statement statements) Adds a statement to the object initializer.- Parameters:
- statements- the statement to be added
 
 - 
getObjectInitializerStatementspublic java.util.List<Statement> getObjectInitializerStatements() 
 - 
addStaticInitializerStatementspublic void addStaticInitializerStatements(java.util.List<Statement> staticStatements, boolean fieldInit) 
 - 
positionStmtsAfterEnumInitStmtspublic void positionStmtsAfterEnumInitStmts(java.util.List<Statement> staticFieldStatements) 
 - 
getDeclaredMethodspublic java.util.List<MethodNode> getDeclaredMethods(java.lang.String name) This methods returns a list of all methods of the given name defined in the current class- Returns:
- the method list
- See Also:
- getMethods(String)
 
 - 
getMethodspublic java.util.List<MethodNode> getMethods(java.lang.String name) This methods creates a list of all methods with this name of the current class and of all super classes- Returns:
- the methods list
- See Also:
- getDeclaredMethods(String)
 
 - 
getDeclaredMethodpublic MethodNode getDeclaredMethod(java.lang.String name, Parameter[] parameters) Finds a method matching the given name and parameters in this class.- Returns:
- the method matching the given name and parameters or null
 
 - 
getMethodpublic MethodNode getMethod(java.lang.String name, Parameter[] parameters) Finds a method matching the given name and parameters in this class or any parent class.- Returns:
- the method matching the given name and parameters or null
 
 - 
isDerivedFrompublic boolean isDerivedFrom(ClassNode type) - Parameters:
- type- the ClassNode of interest
- Returns:
- true if this node is derived from the given ClassNode
 
 - 
isDerivedFromGroovyObjectpublic boolean isDerivedFromGroovyObject() - Returns:
- trueif this type implements- GroovyObject
 
 - 
implementsInterfacepublic boolean implementsInterface(ClassNode classNode) - Parameters:
- classNode- the class node for the interface
- Returns:
- trueif this type implements the given interface
 
 - 
declaresInterfacepublic boolean declaresInterface(ClassNode classNode) - Parameters:
- classNode- the class node for the interface
- Returns:
- trueif this class declares that it implements the given interface or if one of its interfaces extends directly/indirectly the interface NOTE: Doesn't consider an interface to implement itself. I think this is intended to be called on ClassNodes representing classes, not interfaces.
 
 - 
getSuperClasspublic ClassNode getSuperClass() - Returns:
- the ClassNodeof the super class of this type
 
 - 
getUnresolvedSuperClasspublic ClassNode getUnresolvedSuperClass() 
 - 
getUnresolvedSuperClasspublic ClassNode getUnresolvedSuperClass(boolean useRedirect) 
 - 
setUnresolvedSuperClasspublic void setUnresolvedSuperClass(ClassNode sn) 
 - 
getUnresolvedInterfacespublic ClassNode[] getUnresolvedInterfaces() 
 - 
getUnresolvedInterfacespublic ClassNode[] getUnresolvedInterfaces(boolean useRedirect) 
 - 
getCompileUnitpublic CompileUnit getCompileUnit() 
 - 
setCompileUnitprotected void setCompileUnit(CompileUnit cu) 
 - 
parametersEqual@Deprecated protected boolean parametersEqual(Parameter[] a, Parameter[] b) Deprecated.- Returns:
- trueif the two arrays are of the same size and have the same contents
 
 - 
getPackageNamepublic java.lang.String getPackageName() 
 - 
getNameWithoutPackagepublic java.lang.String getNameWithoutPackage() 
 - 
visitContentspublic void visitContents(GroovyClassVisitor visitor) 
 - 
getGetterMethodpublic MethodNode getGetterMethod(java.lang.String getterName) 
 - 
getGetterMethodpublic MethodNode getGetterMethod(java.lang.String getterName, boolean searchSuperClasses) 
 - 
getSetterMethodpublic MethodNode getSetterMethod(java.lang.String setterName) 
 - 
getSetterMethodpublic MethodNode getSetterMethod(java.lang.String setterName, boolean voidOnly) 
 - 
isStaticClasspublic boolean isStaticClass() Is this class declared in a static method (such as a closure / inner class declared in a static method)
 - 
setStaticClasspublic void setStaticClass(boolean staticClass) 
 - 
isScriptBodypublic boolean isScriptBody() - Returns:
- trueif this inner class or closure was declared inside a script body
 
 - 
setScriptBodypublic void setScriptBody(boolean scriptBody) 
 - 
isScriptpublic boolean isScript() 
 - 
setScriptpublic void setScript(boolean script) 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
toStringpublic java.lang.String toString(boolean showRedirect) 
 - 
hasPossibleMethodpublic boolean hasPossibleMethod(java.lang.String name, Expression arguments)Determines if the type has a possibly-matching instance method with the given name and arguments.- Parameters:
- name- the name of the method of interest
- arguments- the arguments to match against
- Returns:
- true if a matching method was found
 
 - 
tryFindPossibleMethodpublic MethodNode tryFindPossibleMethod(java.lang.String name, Expression arguments) 
 - 
hasPossibleStaticMethodpublic boolean hasPossibleStaticMethod(java.lang.String name, Expression arguments)Checks if the given method has a possibly matching static method with the given name and arguments.- Parameters:
- name- the name of the method of interest
- arguments- the arguments to match against
- Returns:
- trueif a matching method was found
 
 - 
isInterfacepublic boolean isInterface() 
 - 
isAbstractpublic boolean isAbstract() 
 - 
isResolvedpublic boolean isResolved() 
 - 
isArraypublic boolean isArray() 
 - 
getComponentTypepublic ClassNode getComponentType() 
 - 
getTypeClasspublic java.lang.Class getTypeClass() Returns the concrete class this classnode relates to. However, this method is inherently unsafe as it may return null depending on the compile phase you are using. AST transformations should never use this method directly, but rather obtain a new class node usinggetPlainNodeReference().- Returns:
- the class this classnode relates to. May return null.
 
 - 
hasPackageNamepublic boolean hasPackageName() 
 - 
setAnnotatedpublic void setAnnotated(boolean flag) Marks if the current class uses annotations or not.
 - 
isAnnotatedpublic boolean isAnnotated() 
 - 
asGenericsTypepublic GenericsType asGenericsType() 
 - 
getGenericsTypespublic GenericsType[] getGenericsTypes() 
 - 
setGenericsTypespublic void setGenericsTypes(GenericsType[] genericsTypes) 
 - 
setGenericsPlaceHolderpublic void setGenericsPlaceHolder(boolean b) 
 - 
isGenericsPlaceHolderpublic boolean isGenericsPlaceHolder() 
 - 
isUsingGenericspublic boolean isUsingGenerics() 
 - 
setUsingGenericspublic void setUsingGenerics(boolean b) 
 - 
getPlainNodeReferencepublic ClassNode getPlainNodeReference() 
 - 
isAnnotationDefinitionpublic boolean isAnnotationDefinition() 
 - 
getAnnotationspublic java.util.List<AnnotationNode> getAnnotations() - Overrides:
- getAnnotationsin class- AnnotatedNode
 
 - 
getAnnotationspublic java.util.List<AnnotationNode> getAnnotations(ClassNode type) - Overrides:
- getAnnotationsin class- AnnotatedNode
 
 - 
addTransformpublic void addTransform(java.lang.Class<? extends ASTTransformation> transform, ASTNode node) 
 - 
getTransformspublic java.util.Map<java.lang.Class<? extends ASTTransformation>,java.util.Set<ASTNode>> getTransforms(CompilePhase phase) 
 - 
renameFieldpublic void renameField(java.lang.String oldName, java.lang.String newName)
 - 
removeFieldpublic void removeField(java.lang.String oldName) 
 - 
isEnumpublic boolean isEnum() 
 - 
getInnerClassespublic java.util.Iterator<InnerClassNode> getInnerClasses() - Returns:
- iterator of inner classes defined inside this one
 
 
- 
 
-