|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.designwizard.design.AbstractEntity
org.designwizard.design.ClassNode
public class ClassNode
ClassNode
objects are constructed automatically by the DesignWizard
class when classes
are loaded. To get access to a desired class extracted, do not use the constructor of this class. Instead, use the
class DesignWizard
as it follows:
Instances of the classDesignWizard dw = new DesignWizard("/home/user/application/classes"); ClassNode c = dw.getClass("MyAplicationClassExample");
ClassNode
represent classes and
interfaces in the code extracted. An enum and array are a kind of
class. The primitive Java types (boolean
,
byte
, char
, short
,
int
, long
, float
, and
double
), and the keyword void
are also
represented as Class
objects.
Inner Classes are also represented as Class
objects, but with
the the special identifier $. For example:
foo.bar.OuterClass$InnerClass
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.designwizard.design.Entity |
---|
Entity.TypesOfEntities |
Field Summary |
---|
Fields inherited from class org.designwizard.design.AbstractEntity |
---|
modifiers, name, relations, type |
Constructor Summary | |
---|---|
ClassNode(java.lang.String name)
Creates a new ClassEntity . |
Method Summary | |
---|---|
void |
addRelation(Relation relation)
Adds a relation for this entity. |
boolean |
equals(java.lang.Object other)
Verifies if this entity is equals the other entity. |
boolean |
extendsClass(ClassNode classNode)
Checks whether the class represented by this ClasNode object
extends the parameter class. |
java.util.Set<FieldNode> |
getAllFields()
Returns a java.util.Set containing FieldNode objects reflecting all
the fields (inherited and declared) of the class or interface represented by this Class object. |
java.util.Set<MethodNode> |
getAllMethods()
Returns a java.util.Set containing MethodNode objects reflecting all
the methods of the class or interface represented by this ClassNode object, including those declared by the class
or interface and those inherited from superclasses and superinterfaces. |
java.util.Set<MethodNode> |
getAllMethodsThatReturn(java.lang.String type)
Returns a java.util.Set representing the methods of the class or interface represented by this
ClassNode object that returns the type specified by type. |
java.util.Set<ClassNode> |
getCalleeClasses()
Returns a java.util.Set containing ClassNode objects reflecting all
the classes that are referenced by the class or interface represented by this ClassNode. |
java.util.Set<MethodNode> |
getCalleeMethods()
Returns a Set of MethodNode containing the methods that
are called by this Entity . |
java.util.Set<PackageNode> |
getCalleePackages()
Returns a Set of PackageNode containing the packages that are referenced
by this Entity . |
java.util.Set<ClassNode> |
getCallerClasses()
Returns a java.util.Set containing ClassNode objects reflecting all
the classes that reference the class or interface represented by this ClassNode. |
java.util.Set<MethodNode> |
getCallerMethods()
Returns a java.util.Set containing MethodNode objects reflecting all
the methods that reference the class or interface represented by this |
java.util.Set<PackageNode> |
getCallerPackages()
Returns a Set of PackageNode containing the packages that reference this Entity . |
java.lang.String |
getClassName()
Returns the name of the entity (class, interface, array class, primitive type, or void) represented by this ClassNode object, as a String. |
ClassNode |
getClassNode()
Returns the ClassNode that represents this Entity object. |
java.util.Set<MethodNode> |
getConstructors()
Returns a java.util.Set containing MethodNode objects reflecting
all constructors of the class represented by this
ClassNode object. |
java.util.Set<FieldNode> |
getDeclaredFields()
Returns a java.util.Set array of FieldNode objects reflecting all the fields
declared (excluding inhireted fields) by the class or interface represented by this
ClassNode object. |
MethodNode |
getDeclaredMethod(java.lang.String shortName)
Returns a MethodNode object that reflects the specified
declared method of the class or interface represented by this
ClassNode object. |
java.util.Set<MethodNode> |
getDeclaredMethods()
Returns a java.util.Set of MethodNode objects reflecting all the
methods declared (excluding the inherited methods) by the class or interface represented by this
ClassNode object. |
java.util.Set<ClassNode> |
getEntitiesThatImplements()
Determines the entities that implements the interface represented by this object. |
FieldNode |
getField(java.lang.String name)
Returns a FieldNode object that reflects the specified field
of the class or interface represented by this ClassNode object. |
java.util.List<java.lang.String[]> |
getImpactOfAChange()
Returns a List of String arrays that represents the trace of calls. |
java.util.Set<ClassNode> |
getImplementedInterfaces()
Determines the interfaces implemented by the class or interface represented by this object. |
java.util.Set<FieldNode> |
getInheritedFields()
Returns a java.util.Set of FieldNode objects inherited
by this ClassNode . |
MethodNode |
getInheritedMethod(java.lang.String shortName)
Returns a MethodNode object that reflects the specified
inherited method of the class or interface represented by this
ClassNode object. |
java.util.Set<MethodNode> |
getInheritedMethods()
Returns a java.util.Set of MethodNode objects reflecting all the
methods inherited by the class or interface represented by this
ClassNode object. |
java.util.Set<ClassNode> |
getInnerClasses()
Returns a java.util.Set containing the ClassNode objects representing the inner classes
of this ClassNode . |
java.util.Set<MethodNode> |
getMethods(Modifier... modifiers)
Returns a java.util.Set representing the methods of the class or interface represented by this
ClassNode object that contains the specified modifiers. |
ClassNode |
getOuterClass()
Returns the ClassNode representing the outer class of the entity
represented by this ClassNode . |
PackageNode |
getPackage()
Gets the PackageNode object that represents
the package of this class. |
java.lang.String |
getShortName()
Returns the short name of this Entity . |
java.util.Set<MethodNode> |
getStaticMethods()
Returns a java.util.Set containing MethodNode objects reflecting all
the static methods of the class or interface represented by this ClassNode object. |
java.util.Set<ClassNode> |
getSubClasses()
Returns a java.util.Set representing the subclasses of the entity
represented by this ClassNode . |
ClassNode |
getSuperClass()
Returns the ClassNode representing the superclass of the entity
represented by this ClassNode . |
int |
hashCode()
|
boolean |
implementsInterface(ClassNode interfaceClassNode)
Checks whether the class represented by this ClasNode object
implements the parameter interface. |
boolean |
isAnonymous()
Returns true if and only if the underlying class is an anonymous class. |
boolean |
isArray()
Determines if this ClassNode object represents an array class. |
boolean |
isClass()
Determines if the specified ClassNode object represents a
class type. |
boolean |
isInnerClass()
Determines if the specified ClassNode object represents an
inner class. |
boolean |
isInterface()
Determines if the specified ClassNode object represents an
interface type. |
boolean |
isPrimitive()
Determines if the specified ClassNode object represents a
primitive type. |
java.lang.String |
toString()
Converts the object to a string. |
Methods inherited from class org.designwizard.design.AbstractEntity |
---|
addModifier, addModifiers, containsModifiers, containsRelation, getModifiers, getName, getRelations, getTypeOfEntity, getVisibility, isAbstract, removeRelation |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.designwizard.design.Entity |
---|
addModifier, addModifiers, containsModifiers, containsRelation, getModifiers, getName, getRelations, getTypeOfEntity, getVisibility, isAbstract, removeRelation |
Constructor Detail |
---|
public ClassNode(java.lang.String name)
ClassEntity
.
name
- the name of the ClassEntity
.visibility
- the visibility of the ClassEntity
.Method Detail |
---|
public ClassNode getOuterClass()
ClassNode
representing the outer class of the entity
represented by this ClassNode
. If this ClassNode
does not represent an InnerClass then null is returned.
public java.util.Set<ClassNode> getInnerClasses()
java.util.Set
containing the ClassNode
objects representing the inner classes
of this ClassNode
. If this ClassNode
does not contain InnerClasses then
an empty set is returned.
ClassNode
objects representing the inner classes
of this ClassNode
. If this ClassNode
does not contain InnerClasses then
an empty set is returned.public void addRelation(Relation relation)
AbstractEntity
addRelation
in interface Entity
addRelation
in class AbstractEntity
relation
- the relation to be added.public java.lang.String getShortName()
Entity
Entity
.
The short name of an attribute is just its name.
For example, if the short name of attribute out from class System
is out but not java.lang.System.out.
The short name of a method is just its name and signature.
For example, the short name of clone method from Object class is clone() but not java.lang.Object.clone().
The short name of a class is just its name. Not the fully qualified name.
For example, the short name of Object class is Object but not java.lang.Object.
getShortName
in interface Entity
getShortName
in class AbstractEntity
Entity
.public java.util.Set<MethodNode> getAllMethods()
java.util.Set
containing MethodNode
objects reflecting all
the methods of the class or interface represented by this ClassNode
object, including those declared by the class
or interface and those inherited from superclasses and superinterfaces.
MethodNode
objects representing the
methods of this class.public java.util.Set<MethodNode> getStaticMethods()
java.util.Set
containing MethodNode
objects reflecting all
the static methods of the class or interface represented by this ClassNode
object.
MethodNode
objects representing the
static methods of this class.public java.util.Set<ClassNode> getSubClasses()
java.util.Set
representing the subclasses of the entity
represented by this ClassNode
. If this ClassNode
represents an entity
that does not have subclasses, then an empty set is returned.
java.util.Set
representing the subclasses of the entity
represented by this ClassNode
. If this ClassNode
represents an entity
that does not have subclasses, then an empty set is returned.public ClassNode getSuperClass()
ClassNode
representing the superclass of the entity
represented by this ClassNode
.
public java.util.Set<MethodNode> getAllMethodsThatReturn(java.lang.String type)
java.util.Set
representing the methods of the class or interface represented by this
ClassNode
object that returns the type specified by type.
The type
parameter is a String
that specifies the fully qualified name of the desired
return type. For example java.lang.String
.
If the the class or interface represented by this
ClassNode
object does not declare a method
with the specified return type, then an empty set is returned.
name
- return desired type
MethodNode
object for the method of this class
matching the specified return type.
If the the class or interface represented by this
ClassNode
object does not declare any method
with the specified return type, then an empty set is returnedpublic java.util.Set<MethodNode> getMethods(Modifier... modifiers)
java.util.Set
representing the methods of the class or interface represented by this
ClassNode
object that contains the specified modifiers.
If the the class or interface represented by this
ClassNode
object does not declare any method
with the specified modifiers, then an empty set is returned.
modifiers
- the desired modifiers
MethodNode
object for the method of this class
matching the specified modifiers
If the the class or interface represented by this
ClassNode
object does not declare a method
with the specified modifiers, then an empty set is returned.public java.util.Set<MethodNode> getConstructors()
java.util.Set
containing MethodNode
objects reflecting
all constructors of the class represented by this
ClassNode
object. An empty set is returned if the
class has no constructors, or if the class is an array class, or
if the class reflects a primitive type or void.
MethodNode
objects representing the
constructors of this classpublic java.util.Set<FieldNode> getDeclaredFields()
java.util.Set
array of FieldNode
objects reflecting all the fields
declared (excluding inhireted fields) by the class or interface represented by this
ClassNode
object. This method returns an empty set if the class
or interface declares no fields, or if this ClassNode
object
represents a primitive type, an array class, or void.
FieldNode
objects representing all the
declared fields of this classpublic java.util.List<java.lang.String[]> getImpactOfAChange()
Entity
List
of String
arrays that represents the trace of calls.
The deep of the search is configured on designwizard.properties
getImpactOfAChange
in interface Entity
public java.lang.String toString()
toString
in class AbstractEntity
public java.util.Set<FieldNode> getInheritedFields()
java.util.Set
of FieldNode
objects inherited
by this ClassNode
.
java.util.Set
of FieldNode
objects inherited
by this ClassNode
.public java.util.Set<FieldNode> getAllFields()
java.util.Set
containing FieldNode
objects reflecting all
the fields (inherited and declared) of the class or interface represented by this Class
object.
This method returns an empty set if the class or interface has fields,
or if it represents an array class, a primitive type, or void.
FieldNode
objects representing the
fields. * This method returns an empty set if the class or interface has fields,
or if it represents an array class, a primitive type, or void.public boolean isPrimitive()
ClassNode
object represents a
primitive type.
There are nine predefined ClassNode
objects to represent
the eight primitive types and void. These are created by the Java
Virtual Machine, and have the same names as the primitive types that
they represent, namely boolean
, byte
,
char
, short
, int
,
long
, float
, and double
.
public boolean isInnerClass()
ClassNode
object represents an
inner class.
public boolean isAnonymous()
public boolean isArray()
ClassNode
object represents an array class.
true
if this object represents an array class;
false
otherwise.public java.util.Set<ClassNode> getImplementedInterfaces()
If this object represents a class, the return value is a java.util.Set
containing objects representing all interfaces implemented by the
class.
If this object represents an interface, the set contains objects representing all interfaces extended by the interface.
If this object represents a class or interface that implements no interfaces, the method returns an empty set.
If this object represents a primitive type or void, the method returns an empty set.
java.util.Set
containing objects representing all interfaces implemented by the
class.public PackageNode getPackage()
PackageNode
object that represents
the package of this class.
getPackage
in interface Entity
public ClassNode getClassNode()
Entity
ClassNode
that represents this Entity
object.
For instance, if this Entity
object is a FieldNode
, this method will return the
ClassNode
that contains the field. The same is applied to MethodNode
s objects.
getClassNode
in interface Entity
ClassNode
object that represents this Entity
object.public boolean isClass()
ClassNode
object represents a
class type.
true
if this object represents a class;
false
otherwise.public boolean isInterface()
ClassNode
object represents an
interface type.
true
if this object represents an interface;
false
otherwise.public FieldNode getField(java.lang.String name) throws InexistentEntityException
FieldNode
object that reflects the specified field
of the class or interface represented by this ClassNode
object.
The name
parameter is a String
specifying the simple
name of the desired field.
name
- the field name
FieldNode
object of this class specified by
name
InexistentEntityException
- if a field with the specified name is not found.public java.util.Set<MethodNode> getDeclaredMethods()
java.util.Set
of MethodNode
objects reflecting all the
methods declared (excluding the inherited methods) by the class or interface represented by this
ClassNode
object. The elements in the set returned are not sorted and
are not in any particular order. This method returns an empty set if the class
or interface declares no methods, or if this ClassNode
object
represents a primitive type, an array class, or void. The class
initialization method <clinit>
is not included in the
returned set.
MethodNode
objects representing all the
declared methods of this classpublic java.util.Set<MethodNode> getInheritedMethods()
java.util.Set
of MethodNode
objects reflecting all the
methods inherited by the class or interface represented by this
ClassNode
object.
MethodNode
objects representing all the
inherited methods of this classpublic MethodNode getDeclaredMethod(java.lang.String shortName)
MethodNode
object that reflects the specified
declared method of the class or interface represented by this
ClassNode
object. The name
parameter is a
String
that specifies the short name of the desired
method. For example, the short name of this method is:
getDeclaredMethod("equals(java.lang.Object)")
If the the class or interface represented by this
ClassNode
object does not declare a method
with the specified short name, then null is returned.
name
- the name of the method
MethodNode
object for the method of this class
matching the specified short name. If the the class or interface
represented by this ClassNode
object does not declare a method
with the specified short name, then null is returned.public MethodNode getInheritedMethod(java.lang.String shortName)
MethodNode
object that reflects the specified
inherited method of the class or interface represented by this
ClassNode
object. The name
parameter is a
String
that specifies the short name of the desired
method. For example, the short name of this method is:
getInheritedMethod(java.lang.String)
If the the class or interface represented by this
ClassNode
object does not have an inherited method
with the specified short name, then null is returned.
name
- the name of the method
MethodNode
object for the method of this class
matching the specified short name. If the the class or interface
represented by this ClassNode
object does not have a method
with the specified short name, then null is returned.public java.lang.String getClassName()
If this class object represents a primitive type or void, then the
name returned is the own name (boolean
, byte
,
char
, short
, int
,
long
, float
, and double
).
getClassName
in interface Entity
public java.util.Set<ClassNode> getEntitiesThatImplements() throws NotAnInterfaceException
ClassNode
representing the classes that implement
this interface.
NotAnInterfaceException
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class AbstractEntity
public java.util.Set<MethodNode> getCallerMethods()
java.util.Set
containing MethodNode
objects reflecting all
the methods that reference the class or interface represented by this
getCallerMethods
in interface Entity
Set
containing the methods that calls this Entity
.public java.util.Set<MethodNode> getCalleeMethods()
Entity
Set
of MethodNode
containing the methods that
are called by this Entity
.
getCalleeMethods
in interface Entity
Set
containing the methods that are called by this Entity
.public java.util.Set<ClassNode> getCallerClasses()
java.util.Set
containing ClassNode
objects reflecting all
the classes that reference the class or interface represented by this ClassNode.
getCallerClasses
in interface Entity
getCallerClasses
in class AbstractEntity
public java.util.Set<ClassNode> getCalleeClasses()
java.util.Set
containing ClassNode
objects reflecting all
the classes that are referenced by the class or interface represented by this ClassNode.
getCalleeClasses
in interface Entity
getCalleeClasses
in class AbstractEntity
public java.util.Set<PackageNode> getCalleePackages()
Entity
Set
of PackageNode
containing the packages that are referenced
by this Entity
.
getCalleePackages
in interface Entity
Set
containing the packages that are referenced
by this Entity
.public java.util.Set<PackageNode> getCallerPackages()
Entity
Set
of PackageNode
containing the packages that reference this Entity
.
getCallerPackages
in interface Entity
Set
containing the packages that reference this Entity
.public boolean extendsClass(ClassNode classNode)
ClasNode
object
extends the parameter class.
classNode
- The class to be verified as super class of this ClassNode
.
public boolean implementsInterface(ClassNode interfaceClassNode)
ClasNode
object
implements the parameter interface.
interface
- The interface to be verified.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |