Java Doc for ClassNode.java in  » Scripting » groovy-1.0 » org » codehaus » groovy » ast » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » groovy 1.0 » org.codehaus.groovy.ast 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.codehaus.groovy.ast.ASTNode
      org.codehaus.groovy.ast.AnnotatedNode
         org.codehaus.groovy.ast.ClassNode

All known Subclasses:   org.codehaus.groovy.ast.MixinNode,  org.codehaus.groovy.ast.InnerClassNode,
ClassNode
public class ClassNode extends AnnotatedNode implements Opcodes(Code)
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 meschanism 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. All method calls are then redirected to that ClassNode.
Note: the proxy mechanism is only allowed for classes being marked as primary ClassNode which means they represent no actual class. The redirect itself can be any type of ClassNode
See Also:   org.codehaus.groovy.ast.ClassHelper
author:
   James Strachan
author:
   Jochen Theodorou
version:
   $Revision: 4216 $


Field Summary
public static  ClassNode[]EMPTY_ARRAY
    
public static  ClassNodeSUPER
    
public static  ClassNodeTHIS
    
protected  Classclazz
    
 booleanisPrimaryNode
    
protected  ObjectlazyInitLock
    

Constructor Summary
public  ClassNode(Class c)
     Creates a ClassNode from a real class.
public  ClassNode(String name, int modifiers, ClassNode superClass)
    
public  ClassNode(String name, int modifiers, ClassNode superClass, ClassNode[] interfaces, MixinNode[] mixins)
    

Method Summary
public  voidaddConstructor(ConstructorNode node)
    
public  ConstructorNodeaddConstructor(int modifiers, Parameter[] parameters, ClassNode[] exceptions, Statement code)
    
public  voidaddField(FieldNode node)
    
public  FieldNodeaddField(String name, int modifiers, ClassNode type, Expression initialValue)
    
public  voidaddInterface(ClassNode type)
    
public  voidaddMethod(MethodNode node)
    
public  MethodNodeaddMethod(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.
public  voidaddMixin(MixinNode mixin)
    
public  voidaddObjectInitializerStatements(Statement statements)
    
public  voidaddProperty(PropertyNode node)
    
public  PropertyNodeaddProperty(String name, int modifiers, ClassNode type, Expression initialValueExpression, Statement getterBlock, Statement setterBlock)
    
public  voidaddStaticInitializerStatements(List staticStatements, boolean fieldInit)
    
public  MethodNodeaddSyntheticMethod(String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code)
    
protected  MethodNodecreateMethodNode(Method method)
    
protected  ParametercreateParameter(Class parameterType, int idx)
    
protected  Parameter[]createParameters(Class[] types)
    
public  booleandeclaresInterface(String name)
    
public  booleanequals(Object o)
    
public  ListgetAbstractMethods()
    
public  ListgetAllDeclaredMethods()
    
public  CompileUnitgetCompileUnit()
    
public  ClassNodegetComponentType()
    
public  ListgetDeclaredConstructors()
    
public  MethodNodegetDeclaredMethod(String name, Parameter[] parameters)
    
public  ListgetDeclaredMethods(String name)
    
protected  MapgetDeclaredMethodsMap()
    
public  MethodNodegetEnclosingMethod()
    
public  FieldNodegetField(String name)
    
public  ListgetFields()
    
public  MethodNodegetGetterMethod(String getterName)
    
public  ClassNode[]getInterfaces()
    
public  ListgetMethods()
    
public  ListgetMethods(String name)
    
public  MixinNode[]getMixins()
    
public  intgetModifiers()
    
public  ModuleNodegetModule()
    
public  StringgetName()
    
public  StringgetNameWithoutPackage()
    
public  ListgetObjectInitializerStatements()
    
public  ClassNodegetOuterClass()
    
public  FieldNodegetOuterField(String name)
    
public  StringgetPackageName()
    
public  ListgetProperties()
    
public  MethodNodegetSetterMethod(String getterName)
    
public  ClassNodegetSuperClass()
    
public  ClassgetTypeClass()
    
public  ClassNodegetUnresolvedSuperClass()
    
public  booleanhasPackageName()
    
public  booleanhasPossibleMethod(String name, Expression arguments)
    
public  booleanimplementsInterface(String name)
    
public  booleanisArray()
    
public  booleanisDerivedFrom(ClassNode type)
    
public  booleanisDerivedFromGroovyObject()
     true if this class is derived from a groovy objecti.e.
public  booleanisInterface()
    
public  booleanisPrimaryClassNode()
    
public  booleanisResolved()
    
public  booleanisScript()
    
public  booleanisScriptBody()
    
public  booleanisStaticClass()
    
public  ClassNodemakeArray()
    
protected  booleanparametersEqual(Parameter[] a, Parameter[] b)
    
protected  ClassNoderedirect()
     Returns the ClassNode this ClassNode is redirecting to.
protected  voidsetCompileUnit(CompileUnit cu)
    
public  voidsetEnclosingMethod(MethodNode enclosingMethod)
    
public  voidsetModule(ModuleNode module)
    
public  StringsetName(String name)
    
public  voidsetRedirect(ClassNode cn)
     Sets this instance as proxy for the given ClassNode.
public  voidsetScript(boolean script)
    
public  voidsetScriptBody(boolean scriptBody)
    
public  voidsetStaticClass(boolean staticClass)
    
public  voidsetSuperClass(ClassNode superClass)
    
public  StringtoString()
    
public  voidvisitContents(GroovyClassVisitor visitor)
    

Field Detail
EMPTY_ARRAY
public static ClassNode[] EMPTY_ARRAY(Code)



SUPER
public static ClassNode SUPER(Code)



THIS
public static ClassNode THIS(Code)



clazz
protected Class clazz(Code)



isPrimaryNode
boolean isPrimaryNode(Code)



lazyInitLock
protected Object lazyInitLock(Code)




Constructor Detail
ClassNode
public ClassNode(Class c)(Code)
Creates a ClassNode from a real class. The resulting ClassNode will be no primary ClassNode.



ClassNode
public ClassNode(String name, int modifiers, ClassNode superClass)(Code)

Parameters:
  name - is the full name of the class
Parameters:
  modifiers - the modifiers,
Parameters:
  superClass - the base class name - use "java.lang.Object" if no directbase class
See Also:   org.objectweb.asm.Opcodes



ClassNode
public ClassNode(String name, int modifiers, ClassNode superClass, ClassNode[] interfaces, MixinNode[] mixins)(Code)

Parameters:
  name - is the full name of the class
Parameters:
  modifiers - the modifiers,
Parameters:
  superClass - the base class name - use "java.lang.Object" if no directbase class
See Also:   org.objectweb.asm.Opcodes




Method Detail
addConstructor
public void addConstructor(ConstructorNode node)(Code)



addConstructor
public ConstructorNode addConstructor(int modifiers, Parameter[] parameters, ClassNode[] exceptions, Statement code)(Code)



addField
public void addField(FieldNode node)(Code)



addField
public FieldNode addField(String name, int modifiers, ClassNode type, Expression initialValue)(Code)



addInterface
public void addInterface(ClassNode type)(Code)



addMethod
public void addMethod(MethodNode node)(Code)



addMethod
public MethodNode addMethod(String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code)(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.



addMixin
public void addMixin(MixinNode mixin)(Code)



addObjectInitializerStatements
public void addObjectInitializerStatements(Statement statements)(Code)



addProperty
public void addProperty(PropertyNode node)(Code)



addProperty
public PropertyNode addProperty(String name, int modifiers, ClassNode type, Expression initialValueExpression, Statement getterBlock, Statement setterBlock)(Code)



addStaticInitializerStatements
public void addStaticInitializerStatements(List staticStatements, boolean fieldInit)(Code)



addSyntheticMethod
public MethodNode addSyntheticMethod(String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code)(Code)
Adds a synthetic method as part of the compilation process



createMethodNode
protected MethodNode createMethodNode(Method method)(Code)
Factory method to create a new MethodNode via reflection



createParameter
protected Parameter createParameter(Class parameterType, int idx)(Code)



createParameters
protected Parameter[] createParameters(Class[] types)(Code)

Parameters:
  types -



declaresInterface
public boolean declaresInterface(String name)(Code)

Parameters:
  name - the fully qualified name of the interface true if this class declares that it implements the given interface



equals
public boolean equals(Object o)(Code)



getAbstractMethods
public List getAbstractMethods()(Code)
Returns a list containing MethodNode objects for each abstract method in the class represented by this ClassNode



getAllDeclaredMethods
public List getAllDeclaredMethods()(Code)



getCompileUnit
public CompileUnit getCompileUnit()(Code)



getComponentType
public ClassNode getComponentType()(Code)



getDeclaredConstructors
public List getDeclaredConstructors()(Code)



getDeclaredMethod
public MethodNode getDeclaredMethod(String name, Parameter[] parameters)(Code)
the method matching the given name and parameters or null



getDeclaredMethods
public List getDeclaredMethods(String name)(Code)
a list of methods which match the given name



getDeclaredMethodsMap
protected Map getDeclaredMethodsMap()(Code)



getEnclosingMethod
public MethodNode getEnclosingMethod()(Code)



getField
public FieldNode getField(String name)(Code)



getFields
public List getFields()(Code)
Returns a list containing FieldNode objects for each field in the class represented by this ClassNode



getGetterMethod
public MethodNode getGetterMethod(String getterName)(Code)



getInterfaces
public ClassNode[] getInterfaces()(Code)
Returns an array of ClassNodes representing the interfaces the class implements



getMethods
public List getMethods()(Code)
Returns a list containing MethodNode objects for each method in the class represented by this ClassNode



getMethods
public List getMethods(String name)(Code)
a list of methods which match the given name



getMixins
public MixinNode[] getMixins()(Code)



getModifiers
public int getModifiers()(Code)



getModule
public ModuleNode getModule()(Code)



getName
public String getName()(Code)



getNameWithoutPackage
public String getNameWithoutPackage()(Code)



getObjectInitializerStatements
public List getObjectInitializerStatements()(Code)



getOuterClass
public ClassNode getOuterClass()(Code)
Helper method to avoid casting to inner class



getOuterField
public FieldNode getOuterField(String name)(Code)
the field node on the outer class or null if this is not aninner class



getPackageName
public String getPackageName()(Code)
the package name of this class



getProperties
public List getProperties()(Code)



getSetterMethod
public MethodNode getSetterMethod(String getterName)(Code)



getSuperClass
public ClassNode getSuperClass()(Code)
the ClassNode of the super class of this type



getTypeClass
public Class getTypeClass()(Code)



getUnresolvedSuperClass
public ClassNode getUnresolvedSuperClass()(Code)



hasPackageName
public boolean hasPackageName()(Code)



hasPossibleMethod
public boolean hasPossibleMethod(String name, Expression arguments)(Code)
Returns true if the given method has a possibly matching method with the given name and arguments



implementsInterface
public boolean implementsInterface(String name)(Code)

Parameters:
  name - the fully qualified name of the interface true if this class or any base class implements the given interface



isArray
public boolean isArray()(Code)



isDerivedFrom
public boolean isDerivedFrom(ClassNode type)(Code)
true if this node is derived from the given class node



isDerivedFromGroovyObject
public boolean isDerivedFromGroovyObject()(Code)
true if this class is derived from a groovy objecti.e. it implements GroovyObject



isInterface
public boolean isInterface()(Code)



isPrimaryClassNode
public boolean isPrimaryClassNode()(Code)
Returns if this instance is a primary ClassNode



isResolved
public boolean isResolved()(Code)



isScript
public boolean isScript()(Code)



isScriptBody
public boolean isScriptBody()(Code)
Returns true if this inner class or closure was declared inside a script body



isStaticClass
public boolean isStaticClass()(Code)
Is this class delcared in a static method (such as a closure / inner class declared in a static method)



makeArray
public ClassNode makeArray()(Code)
Returns a ClassNode representing an array of the class represented by this ClassNode



parametersEqual
protected boolean parametersEqual(Parameter[] a, Parameter[] b)(Code)
true if the two arrays are of the same size and have the same contents



redirect
protected ClassNode redirect()(Code)
Returns the ClassNode this ClassNode is redirecting to.



setCompileUnit
protected void setCompileUnit(CompileUnit cu)(Code)



setEnclosingMethod
public void setEnclosingMethod(MethodNode enclosingMethod)(Code)



setModule
public void setModule(ModuleNode module)(Code)



setName
public String setName(String name)(Code)



setRedirect
public void setRedirect(ClassNode cn)(Code)
Sets this instance as proxy for the given ClassNode.
Parameters:
  cn - the class to redirect to. If set to null the redirect will be removed



setScript
public void setScript(boolean script)(Code)



setScriptBody
public void setScriptBody(boolean scriptBody)(Code)



setStaticClass
public void setStaticClass(boolean staticClass)(Code)



setSuperClass
public void setSuperClass(ClassNode superClass)(Code)
Sets the superclass of this ClassNode



toString
public String toString()(Code)



visitContents
public void visitContents(GroovyClassVisitor visitor)(Code)



Fields inherited from org.codehaus.groovy.ast.AnnotatedNode
ClassNode declaringClass(Code)(Java Doc)

Methods inherited from org.codehaus.groovy.ast.AnnotatedNode
public void addAnnotation(String name, AnnotationNode value)(Code)(Java Doc)
public void addAnnotations(List annotations)(Code)(Java Doc)
public ClassNode getAnnotationClass(String name)(Code)(Java Doc)
public Map getAnnotations()(Code)(Java Doc)
public AnnotationNode getAnnotations(String name)(Code)(Java Doc)
public ClassNode getDeclaringClass()(Code)(Java Doc)
public boolean isSynthetic()(Code)(Java Doc)
public void setDeclaringClass(ClassNode declaringClass)(Code)(Java Doc)
public void setSynthetic(boolean synthetic)(Code)(Java Doc)

Methods inherited from org.codehaus.groovy.ast.ASTNode
public int getColumnNumber()(Code)(Java Doc)
public int getLastColumnNumber()(Code)(Java Doc)
public int getLastLineNumber()(Code)(Java Doc)
public int getLineNumber()(Code)(Java Doc)
public String getText()(Code)(Java Doc)
public void setColumnNumber(int columnNumber)(Code)(Java Doc)
public void setLastColumnNumber(int lastColumnNumber)(Code)(Java Doc)
public void setLastLineNumber(int lastLineNumber)(Code)(Java Doc)
public void setLineNumber(int lineNumber)(Code)(Java Doc)
public void setSourcePosition(ASTNode node)(Code)(Java Doc)
public void visit(GroovyCodeVisitor visitor)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.