|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.groovy.ast.ASTNode
org.codehaus.groovy.ast.AnnotatedNode
org.codehaus.groovy.ast.ClassNode
Represents a class declaration
Field Summary |
Fields inherited from class org.codehaus.groovy.ast.ASTNode |
EMPTY_STRING_ARRAY |
Fields inherited from interface org.objectweb.asm.Constants |
AALOAD, AASTORE, ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_DEPRECATED, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VARARGS, ACC_VOLATILE, ACONST_NULL, ALOAD, ANEWARRAY, ARETURN, ARRAYLENGTH, ASTORE, ATHROW, BALOAD, BASTORE, BIPUSH, CALOAD, CASTORE, CHECKCAST, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DLOAD, DMUL, DNEG, DREM, DRETURN, DSTORE, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FMUL, FNEG, FREM, FRETURN, FSTORE, FSUB, GETFIELD, GETSTATIC, GOTO, 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, 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, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, POP, POP2, PUTFIELD, PUTSTATIC, RET, RETURN, SALOAD, SASTORE, SIPUSH, SWAP, T_BOOLEAN, T_BYTE, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_LONG, T_SHORT, TABLESWITCH, V1_1, V1_2, V1_3, V1_4, V1_5 |
Constructor Summary | |
ClassNode(String name,
int modifiers,
String superClass)
|
|
ClassNode(String name,
int modifiers,
String superClass,
String[] interfaces,
MixinNode[] mixins)
|
Method Summary | |
void |
addConstructor(ConstructorNode node)
|
ConstructorNode |
addConstructor(int modifiers,
Parameter[] parameters,
Statement code)
|
void |
addField(FieldNode node)
|
FieldNode |
addField(String name,
int modifiers,
String type,
Expression initialValue)
|
void |
addInterface(String name)
|
void |
addMethod(MethodNode node)
|
MethodNode |
addMethod(String name,
int modifiers,
String returnType,
Parameter[] parameters,
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. |
void |
addMixin(MixinNode mixin)
|
void |
addProperty(PropertyNode node)
|
PropertyNode |
addProperty(String name,
int modifiers,
String type,
Expression initialValueExpression,
Statement getterBlock,
Statement setterBlock)
|
void |
addStaticInitializerStatements(List staticStatements)
|
MethodNode |
addSyntheticMethod(String name,
int modifiers,
String returnType,
Parameter[] parameters,
Statement code)
Adds a synthetic method as part of the compilation process |
protected ClassNode |
createClassNode(Class theClass)
|
protected MethodNode |
createMethodNode(Method method)
Factory method to create a new MethodNode via reflection |
protected Parameter |
createParameter(Class parameterType,
int idx)
|
protected Parameter[] |
createParameters(Class[] types)
|
boolean |
declaresInterface(String name)
|
ClassNode |
findClassNode(String type)
Attempts to lookup the fully qualified class name in the compile unit or classpath |
protected int |
findMatchingMethodInList(MethodNode method,
List methods)
|
List |
getAbstractMethods()
|
List |
getAllDeclaredMethods()
|
String |
getClassNameForExpression(String identifier)
|
CompileUnit |
getCompileUnit()
|
List |
getDeclaredConstructors()
|
MethodNode |
getDeclaredMethod(String name,
Parameter[] parameters)
|
List |
getDeclaredMethods(String name)
|
protected Map |
getDeclaredMethodsMap()
|
MethodNode |
getEnclosingMethod()
|
FieldNode |
getField(String name)
|
List |
getFields()
|
MethodNode |
getGetterMethod(String getterName)
|
String[] |
getInterfaces()
|
List |
getMethods()
|
List |
getMethods(String name)
|
MixinNode[] |
getMixins()
|
int |
getModifiers()
|
ModuleNode |
getModule()
|
String |
getName()
|
String |
getNameWithoutPackage()
|
ClassNode |
getOuterClass()
Helper method to avoid casting to inner class |
FieldNode |
getOuterField(String name)
|
String |
getPackageName()
|
List |
getProperties()
|
MethodNode |
getSetterMethod(String getterName)
|
String |
getSuperClass()
|
ClassNode |
getSuperClassNode()
|
boolean |
hasPossibleMethod(String name,
Expression arguments)
Returns true if the given method has a possibly matching method with the given name and arguments |
boolean |
implementsInteface(String name)
|
boolean |
isDerivedFrom(String name)
|
boolean |
isDerivedFromGroovyObject()
|
boolean |
isScript()
|
boolean |
isScriptBody()
|
boolean |
isStaticClass()
Is this class delcared in a static method (such as a closure / inner class declared in a static method) |
protected boolean |
parametersEqual(Parameter[] a,
Parameter[] b)
|
String |
resolveClassName(String type)
|
void |
setEnclosingMethod(MethodNode enclosingMethod)
|
void |
setModule(ModuleNode module)
|
void |
setScript(boolean script)
|
void |
setScriptBody(boolean scriptBody)
|
void |
setStaticClass(boolean staticClass)
|
void |
setSuperClass(String superClass)
|
String |
toString()
|
protected String |
tryResolveClassFromCompileUnit(String type)
|
void |
visitContents(GroovyClassVisitor visitor)
|
Methods inherited from class org.codehaus.groovy.ast.AnnotatedNode |
addAnnotation, addAnnotations, getAnnotations, getAnnotations, isSynthetic, setSynthetic |
Methods inherited from class org.codehaus.groovy.ast.ASTNode |
getColumnNumber, getLineNumber, getText, setColumnNumber, setCSTNode, setLineNumber, visit |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ClassNode(String name, int modifiers, String superClass)
name
- is the full name of the classmodifiers
- the modifiers,superClass
- the base class name - use "java.lang.Object" if no direct
base classConstants
public ClassNode(String name, int modifiers, String superClass, String[] interfaces, MixinNode[] mixins)
name
- is the full name of the classmodifiers
- the modifiers,superClass
- the base class name - use "java.lang.Object" if no direct
base classConstants
Method Detail |
public MethodNode getEnclosingMethod()
public void setEnclosingMethod(MethodNode enclosingMethod)
public String getSuperClass()
public void setSuperClass(String superClass)
public List getFields()
public String[] getInterfaces()
public MixinNode[] getMixins()
public List getMethods()
public List getAbstractMethods()
public List getAllDeclaredMethods()
protected Map getDeclaredMethodsMap()
protected int findMatchingMethodInList(MethodNode method, List methods)
public String getName()
public int getModifiers()
public List getProperties()
public List getDeclaredConstructors()
public ModuleNode getModule()
public void setModule(ModuleNode module)
public void addField(FieldNode node)
public void addProperty(PropertyNode node)
public PropertyNode addProperty(String name, int modifiers, String type, Expression initialValueExpression, Statement getterBlock, Statement setterBlock)
public void addConstructor(ConstructorNode node)
public ConstructorNode addConstructor(int modifiers, Parameter[] parameters, Statement code)
public void addMethod(MethodNode node)
public MethodNode addMethod(String name, int modifiers, String returnType, Parameter[] parameters, Statement code)
public MethodNode addSyntheticMethod(String name, int modifiers, String returnType, Parameter[] parameters, Statement code)
public FieldNode addField(String name, int modifiers, String type, Expression initialValue)
public void addInterface(String name)
public void addMixin(MixinNode mixin)
public FieldNode getField(String name)
public FieldNode getOuterField(String name)
public ClassNode getOuterClass()
public void addStaticInitializerStatements(List staticStatements)
public List getDeclaredMethods(String name)
public List getMethods(String name)
public MethodNode getDeclaredMethod(String name, Parameter[] parameters)
public boolean isDerivedFrom(String name)
public boolean isDerivedFromGroovyObject()
public boolean implementsInteface(String name)
name
- the fully qualified name of the interface
public boolean declaresInterface(String name)
name
- the fully qualified name of the interface
public ClassNode getSuperClassNode()
public ClassNode findClassNode(String type)
type
- fully qulified type name
protected ClassNode createClassNode(Class theClass)
protected MethodNode createMethodNode(Method method)
protected Parameter[] createParameters(Class[] types)
types
-
protected Parameter createParameter(Class parameterType, int idx)
public String resolveClassName(String type)
protected String tryResolveClassFromCompileUnit(String type)
type
-
public CompileUnit getCompileUnit()
protected boolean parametersEqual(Parameter[] a, Parameter[] b)
public String getClassNameForExpression(String identifier)
public String getPackageName()
public String getNameWithoutPackage()
public void visitContents(GroovyClassVisitor visitor)
public MethodNode getGetterMethod(String getterName)
public MethodNode getSetterMethod(String getterName)
public boolean isStaticClass()
public void setStaticClass(boolean staticClass)
public boolean isScriptBody()
public void setScriptBody(boolean scriptBody)
public boolean isScript()
public void setScript(boolean script)
public String toString()
public boolean hasPossibleMethod(String name, Expression arguments)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |