org.designwizard.design
Class MethodNode

java.lang.Object
  extended by org.designwizard.design.AbstractEntity
      extended by org.designwizard.design.MethodNode
All Implemented Interfaces:
Entity

public class MethodNode
extends AbstractEntity
implements Entity

A MethodNode provides information about a single method or a constructor on a class or interface. To get access to a desired method extracted, do not use the constructor of this class. Instead, use the class DesignWizard as it follows:

        DesignWizard dw = new DesignWizard("/home/user/application/classes");
                MethodNode c = dw.getMethod("MyAplicationClassExample.method(java.lang.String,int)");  
 

Author:
Joao Brunet
See Also:
ClassNode, ClassNode.getAllMethods(), org.designwizard.design.ClassNode#getMethod(String), ClassNode.getDeclaredMethods(), ClassNode.getInheritedMethods(), ClassNode.getDeclaredMethod(String)

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.designwizard.design.Entity
Entity.TypesOfEntities
 
Field Summary
static java.lang.String CONSTRUCTOR_IDENTIFIER
           
 
Fields inherited from class org.designwizard.design.AbstractEntity
modifiers, name, relations, type
 
Constructor Summary
MethodNode(java.lang.String signature, boolean isConstructor)
          Creates a new Method.
 
Method Summary
 boolean equals(java.lang.Object other)
          Verifies if this entity is equals the other entity.
 java.util.Set<FieldNode> getAccessedFields()
          Returns a Set of FieldNode objects representing the fields accessed by this MethodNode.
 java.util.Set<ClassNode> getCalleeClasses()
          Returns the classes that are referenced by this MethodNode
 java.util.Set<MethodNode> getCalleeMethods()
          Returns the methods that are called by this MethodNode.
 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 the classes that reference this Method.
 java.util.Set<MethodNode> getCallerMethods()
          Returns the Methods that calls this method.
 java.util.Set<PackageNode> getCallerPackages()
          Returns a Set of PackageNode containing the packages that reference this Entity.
 java.util.Set<ClassNode> getCatchedExceptions()
          Returns a java.util.Set of ClassNode objects that represent the types of the exceptions catched by the underlying method represented by this MethodNode object.
 java.lang.String getClassName()
          Returns the name of the class that represents this Entity object.
 ClassNode getClassNode()
          Returns the ClassNode that represents this Entity object.
 ClassNode getDeclaringClass()
          Returns the ClassNode object representing the class or interface that declares the method represented by this MethodNode object.
 java.util.List<java.lang.String[]> getImpactOfAChange()
          Return all methods impacted by a change in this method.
 PackageNode getPackage()
          Gets the PackageNode object that represents the package of this method.
 java.util.Set<ClassNode> getParameters()
          Returns a java.util.Set of ClassNode objects that represent the formal parameter types of the method represented by this Method object.
 ClassNode getReturnType()
          Returns a ClassNode object that represents the formal return type of the method represented by this MethodNode object.
 java.lang.String getShortName()
          Returns the short name of the method represented by this MethodNode object, as a String.
 java.util.Set<ClassNode> getThrownExceptions()
          Returns a java.util.Set of ClassNode objects that represent the types of the exceptions declared to be thrown by the underlying method represented by this Method object.
 int hashCode()
           
 boolean isConstructor()
          Verifies whether this MethodNode is a constructor.
 boolean isStatic()
          Verifies whether this MethodNode is static or not.
 void setParameters(java.util.Set<ClassNode> methodParameters)
           
 java.lang.String toString()
          Method that returns the description of this design element.
 
Methods inherited from class org.designwizard.design.AbstractEntity
addModifier, addModifiers, addRelation, 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, addRelation, containsModifiers, containsRelation, getModifiers, getName, getRelations, getTypeOfEntity, getVisibility, isAbstract, removeRelation
 

Field Detail

CONSTRUCTOR_IDENTIFIER

public static final java.lang.String CONSTRUCTOR_IDENTIFIER
See Also:
Constant Field Values
Constructor Detail

MethodNode

public MethodNode(java.lang.String signature,
                  boolean isConstructor)
Creates a new Method.

Parameters:
signature - the signature of the Method. The signature is composed by its name and parameters. Example: ClassXPTO.setName(java.lang.String)
isConstructor - true if the method is a constructor; false otherwise.
Method Detail

getShortName

public java.lang.String getShortName()
Returns the short name of the method represented by this MethodNode object, as a String.

Specified by:
getShortName in interface Entity
Overrides:
getShortName in class AbstractEntity
Returns:
the short name of this Entity.

isConstructor

public boolean isConstructor()
Verifies whether this MethodNode is a constructor.

Returns:
true if this MethodNode object is a constructor; false otherwise.

getReturnType

public ClassNode getReturnType()
Returns a ClassNode object that represents the formal return type of the method represented by this MethodNode object.

Returns:
the return type for the method this object represents

getDeclaringClass

public ClassNode getDeclaringClass()
Returns the ClassNode object representing the class or interface that declares the method represented by this MethodNode object.


isStatic

public boolean isStatic()
Verifies whether this MethodNode is static or not.

Returns:
true if this method is static; false otherwise.

getCatchedExceptions

public java.util.Set<ClassNode> getCatchedExceptions()
Returns a java.util.Set of ClassNode objects that represent the types of the exceptions catched by the underlying method represented by this MethodNode object. Returns an empty set if the method catches no exceptions.

Returns:
a java.util.Set of ClassNode objects that represent the types of the exceptions catched by the underlying method represented by this MethodNode object.

getImpactOfAChange

public java.util.List<java.lang.String[]> getImpactOfAChange()
Return all methods impacted by a change in this method. The depth of the search is configured on designwizard.properties

Specified by:
getImpactOfAChange in interface Entity
Returns:
All pairs(called/caller) of methods. The trace generated by this method.

getThrownExceptions

public java.util.Set<ClassNode> getThrownExceptions()
Returns a java.util.Set of ClassNode objects that represent the types of the exceptions declared to be thrown by the underlying method represented by this Method object. Returns an empty set if the method declares no exceptions in its throws clause.

Returns:
the exception types declared as being thrown by the method this object represents

getAccessedFields

public java.util.Set<FieldNode> getAccessedFields()
Returns a Set of FieldNode objects representing the fields accessed by this MethodNode.


equals

public boolean equals(java.lang.Object other)
Verifies if this entity is equals the other entity.

Overrides:
equals in class java.lang.Object
Returns:
true if this entity is equals the other entity; false otherwise.

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractEntity

toString

public java.lang.String toString()
Method that returns the description of this design element. The description is a string representation that contains the name of this designElement and all the relations that this designElement is the caller of the relation.

Overrides:
toString in class AbstractEntity
Returns:
a String representation for this element of design.

getClassNode

public ClassNode getClassNode()
Description copied from interface: Entity
Returns the 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 MethodNodes objects.

Specified by:
getClassNode in interface Entity
Returns:
the ClassNode object that represents this Entity object.

getClassName

public java.lang.String getClassName()
Description copied from interface: Entity
Returns the name of the class that represents this Entity object. For instance, if this Entity object is a FieldNode, this method will return the name of the class that contains the field. The same is applied to MethodNodes objects. In the case of ClassNode objects, calling this method has the same effect as the designwizard.design.ClassNode.getName() method.

Specified by:
getClassName in interface Entity
Returns:
the name of the class that represents this Entity object.

setParameters

public void setParameters(java.util.Set<ClassNode> methodParameters)

getParameters

public java.util.Set<ClassNode> getParameters()
Returns a java.util.Set of ClassNode objects that represent the formal parameter types of the method represented by this Method object. Returns an empty set if the underlying method takes no parameters.

Returns:
the parameter types for the method this object represents

getPackage

public PackageNode getPackage()
Gets the PackageNode object that represents the package of this method.

Specified by:
getPackage in interface Entity
Returns:
the package of the method.

getCallerMethods

public java.util.Set<MethodNode> getCallerMethods()
Returns the Methods that calls this method.

Specified by:
getCallerMethods in interface Entity
Returns:
returns the Methods that calls this method.

getCalleeMethods

public java.util.Set<MethodNode> getCalleeMethods()
Returns the methods that are called by this MethodNode.

Specified by:
getCalleeMethods in interface Entity
Returns:
the methods that are called by this MethodNode.

getCallerClasses

public java.util.Set<ClassNode> getCallerClasses()
Returns the classes that reference this Method.

Specified by:
getCallerClasses in interface Entity
Specified by:
getCallerClasses in class AbstractEntity
Returns:
A set that contains all classes that uses this Method.

getCalleeClasses

public java.util.Set<ClassNode> getCalleeClasses()
Returns the classes that are referenced by this MethodNode

Specified by:
getCalleeClasses in interface Entity
Specified by:
getCalleeClasses in class AbstractEntity
Returns:
A set containing all classes that are referenced by this Entity.

getCalleePackages

public java.util.Set<PackageNode> getCalleePackages()
Description copied from interface: Entity
Returns a Set of PackageNode containing the packages that are referenced by this Entity.

Specified by:
getCalleePackages in interface Entity
Returns:
a Set containing the packages that are referenced by this Entity.

getCallerPackages

public java.util.Set<PackageNode> getCallerPackages()
Description copied from interface: Entity
Returns a Set of PackageNode containing the packages that reference this Entity.

Specified by:
getCallerPackages in interface Entity
Returns:
a Set containing the packages that reference this Entity.