|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ca.ubc.cs.elide.nodes.ParseNode | +--ca.ubc.cs.elide.nodes.ChildBearingNode | +--ca.ubc.cs.elide.nodes.ModifierBearingNode | +--ca.ubc.cs.elide.nodes.ClassNode
ClassNode
objects represent classes in the target system.
The easiest way to create ClassNode
s is to call NodeFactory.createClass(java.lang.String)
Constructor Summary | |
ClassNode()
|
|
ClassNode(java.lang.String name)
|
Method Summary | |
void |
extend(java.lang.String text)
Adds new members by describing them in source code. |
static ClassNode |
forName(java.lang.String name,
ParseNode context)
Returns the ClassNode object associated with the class or interface with the given string name in the given
context. |
InstanceBlockNode[] |
getBlocks()
Returns an array of BlockNode objects reflecting all the static blocks of the class represented by this ClassNode object. |
ClassNode |
getClass(java.lang.String name)
Returns a ClassNode object that reflects the specified inner class or interface of the class represented by this ClassNode object. |
ClassNode[] |
getClasses()
Returns an array containing ClassNode objects representing all the public classes and interfaces that are members
of the class represented by this ClassNode object. |
ClassNode |
getDeclaredClass(java.lang.String name)
Returns a ClassNode object reflecting the specified class or interface declared as a member of the class represented by
this ClassNode object. |
ClassNode[] |
getDeclaredClasses()
Returns an array of ClassNode objects reflecting all the classes and interfaces declared as members of the class represented by
this ClassNode object. |
ConstructorNode[] |
getDeclaredConstructors()
Returns an array of ConstructorNode objects reflecting all the fields declared by the class or interface represented by this ClassNode object. |
FieldNode |
getDeclaredField(java.lang.String name)
Returns a FieldNode object that reflects the specified declared field of the class or interface represented by this ClassNode object. |
FieldNode[] |
getDeclaredFields()
Returns an array of FieldNode objects reflecting all the fields declared by the class or interface represented by this ClassNode object. |
MethodNode |
getDeclaredMethod(java.lang.String name)
Returns a Method object that reflects the specified declared method of the class or interface represented by this ClassNode object. |
MethodNode[] |
getDeclaredMethods()
Returns an array of MethodNode objects reflecting all the methods declared by the class or interface represented by this
ClassNode object |
FieldNode |
getField(java.lang.String name)
Returns a FieldNode object that reflects the specified public member field of the class or interface represented by this ClassNode object. |
FieldNode[] |
getFields()
Returns an array containing FieldNode objects reflecting all the accessible public fields of the class or interface represented by this ClassNode object. |
ImportNode[] |
getImports()
Returns an array of ImportNode objects reflecting all units imported to the class represented by this ClassNode object. |
TypeNode[] |
getInterfaces()
Determines the interfaces implemented by the class or interface represented by this object. |
MethodNode |
getMethod(java.lang.String name)
Returns a MethodNode object that reflects the specified public member method of the class or interface represented by this ClassNode object. |
MethodNode[] |
getMethods()
Returns an array containing MethodNode objects reflecting all the public member methods of the class or interface
represented by this ClassNode object, including those declared by the class or interface and and those inherited from superclasses and
superinterfaces. |
java.lang.String |
getName()
Returns the fully-qualified name of the entity (class, interface) represented by this ClassNode object, as a String . |
java.lang.String |
getShortName()
Returns the unqualified name of the entity (class, interface) represented by this ClassNode object, as a String . |
StaticBlockNode[] |
getStaticBlocks()
Returns an array of StaticBlockNode objects reflecting all the static blocks of the class represented by this ClassNode object. |
ClassNode[] |
getSubclasses()
Returns an array containing String objects representing all the subclasses and subinterfaces
of the class represented by this ClassNode object. |
java.lang.String |
getSuperclass()
Returns the ClassNode representing the superclass of the entity (class, interface) represented by this ClassNode . |
java.lang.String[] |
getSuperclasses()
Returns an array containing String objects representing all the superclasses and superinterfaces
of the class represented by this ClassNode object. |
ClassNode |
getSuperclassNode()
Returns the ClassNode representing the superclass of the entity (class, interface, primitive type or void) represented by this ClassNode . |
boolean |
isAssignableFrom(ClassNode klass)
Determines if the class or interface represented by this ClassNode object is either the same as, or is a superclass or superinterface of,
the class or interface represented by the specified ClassNode parameter. |
boolean |
isAssignableFrom(java.lang.String klass)
Determines if the class or interface represented by this ClassNode object is either the same as, or is a superclass or superinterface of,
the class or interface named by the specified String parameter. |
boolean |
isInterface()
Determines if this ClassNode object represents an interface type. |
void |
setInterface(boolean isInterface)
Specifies that this ClassNode object represents an interface type. |
void |
setSuperclass(java.lang.String superclass)
Sets the superclass of the entity (class, interface) represented by this ClassNode to the class specified by the given String . |
Methods inherited from class ca.ubc.cs.elide.nodes.ModifierBearingNode |
getModifiers, makeDefaultAccess, makePrivate, makeProtected, makePublic, setAbstract, setFinal, setNative, setStatic, setSynchronized, setTransient, setVolatile |
Methods inherited from class ca.ubc.cs.elide.nodes.ChildBearingNode |
add, add, addTransform, clone, getChildren, remove |
Methods inherited from class ca.ubc.cs.elide.nodes.ParseNode |
findType, get, getComment, getDeclaringClass, getPackage, getParent, getRoot, put, registerType, setComment, setName, toString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ClassNode()
public ClassNode(java.lang.String name)
Method Detail |
public java.lang.String getName()
ClassNode
object, as a String
.getName
in class ParseNode
public java.lang.String getShortName()
ClassNode
object, as a String
.public MethodNode[] getDeclaredMethods()
MethodNode
objects reflecting all the methods declared by the class or interface represented by this
ClassNode
objectpublic FieldNode[] getDeclaredFields()
FieldNode
objects reflecting all the fields declared by the class or interface represented by this ClassNode
object.public ClassNode[] getDeclaredClasses()
ClassNode
objects reflecting all the classes and interfaces declared as members of the class represented by
this ClassNode
object.public StaticBlockNode[] getStaticBlocks()
StaticBlockNode
objects reflecting all the static blocks of the class represented by this ClassNode
object.public InstanceBlockNode[] getBlocks()
BlockNode
objects reflecting all the static blocks of the class represented by this ClassNode
object.public TypeNode[] getInterfaces()
public ImportNode[] getImports()
ImportNode
objects reflecting all units imported to the class represented by this ClassNode
object.public ConstructorNode[] getDeclaredConstructors()
ConstructorNode
objects reflecting all the fields declared by the class or interface represented by this ClassNode
object.public java.lang.String getSuperclass()
ClassNode
representing the superclass of the entity (class, interface) represented by this ClassNode
.public void setSuperclass(java.lang.String superclass)
ClassNode
to the class specified by the given String
.public boolean isInterface()
ClassNode
object represents an interface type.public void setInterface(boolean isInterface)
ClassNode
object represents an interface type.public MethodNode getDeclaredMethod(java.lang.String name)
ClassNode
object.public FieldNode getDeclaredField(java.lang.String name)
FieldNode
object that reflects the specified declared field of the class or interface represented by this ClassNode
object.public ClassNode getDeclaredClass(java.lang.String name)
ClassNode
object reflecting the specified class or interface declared as a member of the class represented by
this ClassNode
object.public MethodNode getMethod(java.lang.String name)
MethodNode
object that reflects the specified public member method of the class or interface represented by this ClassNode
object.public FieldNode getField(java.lang.String name)
FieldNode
object that reflects the specified public member field of the class or interface represented by this ClassNode
object.public ClassNode getClass(java.lang.String name)
ClassNode
object that reflects the specified inner class or interface of the class represented by this ClassNode
object.public FieldNode[] getFields()
FieldNode
objects reflecting all the accessible public fields of the class or interface represented by this ClassNode
object.public MethodNode[] getMethods()
MethodNode
objects reflecting all the public member methods of the class or interface
represented by this ClassNode
object, including those declared by the class or interface and and those inherited from superclasses and
superinterfaces.public ClassNode[] getClasses()
ClassNode
objects representing all the public classes and interfaces that are members
of the class represented by this ClassNode
object.public ClassNode getSuperclassNode()
ClassNode
representing the superclass of the entity (class, interface, primitive type or void) represented by this ClassNode
.public boolean isAssignableFrom(ClassNode klass)
ClassNode
object is either the same as, or is a superclass or superinterface of,
the class or interface represented by the specified ClassNode
parameter.public boolean isAssignableFrom(java.lang.String klass)
ClassNode
object is either the same as, or is a superclass or superinterface of,
the class or interface named by the specified String parameter.public java.lang.String[] getSuperclasses()
String
objects representing all the superclasses and superinterfaces
of the class represented by this ClassNode
object.public ClassNode[] getSubclasses()
String
objects representing all the subclasses and subinterfaces
of the class represented by this ClassNode
object.public void extend(java.lang.String text)
aClass.extend(%{
private int x;
public void getX() {
return x;
}
}%);
would construct a new FieldNode
and MethodNode
for x and
getX()
, and add them to aClass
Accepts any code valid within the body of a class declaration.public static ClassNode forName(java.lang.String name, ParseNode context)
ClassNode
object associated with the class or interface with the given string name in the given
context. The context parameter has two functions: first, it identifies a particular parse tree to search in. For this
purpose, it can be any node in that tree. Second, it identifies a context in which ambiguous names will
be resolved - for this purpose, the import statements of the class within which the context node was declared will be
respected.
Usually, the context parameter will simply be the target of the active transformation - for example,
satisfies
public addVisitMethod(ClassNode target, String visitor)
{
ClassNode visitorClass = ClassNode.forName(visitor, target);
...
}
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |