org.designwizard.design
Class Design

java.lang.Object
  extended by org.designwizard.design.Design
All Implemented Interfaces:
DesignIF

public class Design
extends java.lang.Object
implements DesignIF

Author:
João Arthur Brunet Monteiro - joaoarthurbm@gmail.com This class represents a model for the facts extracts from .jar file and source code.

Field Summary
 
Fields inherited from interface org.designwizard.design.DesignIF
FIELD_IDENTIFIER, METHOD_IDENTIFIER, STATIC_IDENTIFIER
 
Constructor Summary
Design()
          Constructs a new Design.
 
Method Summary
 void addClassExtractedFromCode(java.lang.String className)
          Adds a class that was extracted from code.
 void addRelation(Relation.TypesOfRelation typeOfRelation, java.lang.String callerName, java.lang.String calledName)
          Adds a new relation in the design.
 boolean containsEntity(java.lang.String entityName)
          Verifies if this design has a entity with the parameter entityName.
 java.util.Set<ClassNode> getAllClasses()
          Returns a Set of ClassNode objects representing all classes extracted.
 java.util.Set<ClassNode> getAllClassesFromCode()
          Returns all the classes from the application's code
 java.util.Set<MethodNode> getAllMethods()
           
 java.util.Set<PackageNode> getAllPackagesFromCode()
           
 ClassNode getClass(java.lang.String className)
          Returns a ClassEntity represented by the specified className.
 Entity getEntity(java.lang.String entityName)
          Method that return the entity with the specified name.
 FieldNode getField(java.lang.String fieldName)
          Returns a Field with the specified name.
 MethodNode getMethod(java.lang.String methodName)
          Returns a Method with the specified name.
 PackageNode getPackage(java.lang.String fullyQualifiedNamePackage)
           
 void packageExtracted(java.lang.String entity)
           
 void resolveDependences()
          Resolve all dependences between entities after extraction.
 void setParameters(java.lang.String method, java.lang.String parameters)
           
 void setReturnType(java.lang.String method, java.lang.String returnType)
          Put the retunrType value on return type of the specified method.
 void setVisibility(java.lang.String entityName, Modifier visibility)
          Returns a set containing all classes extracted.
 java.lang.String toString()
          A String representation for this Design.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Design

public Design()
Constructs a new Design. A design is a set of entities and all the relations between this entities.

Method Detail

addClassExtractedFromCode

public void addClassExtractedFromCode(java.lang.String className)
Adds a class that was extracted from code.

Specified by:
addClassExtractedFromCode in interface DesignIF
Parameters:
className - the name of the class extracted.

packageExtracted

public void packageExtracted(java.lang.String entity)
Specified by:
packageExtracted in interface DesignIF

addRelation

public void addRelation(Relation.TypesOfRelation typeOfRelation,
                        java.lang.String callerName,
                        java.lang.String calledName)
Adds a new relation in the design.

Specified by:
addRelation in interface DesignIF
Parameters:
relation - the relation to be added. pattern: - Methods: M:Class.method(int,double,...) - Fields: F:Class.fieldName - Class: package.subpackage.ClassName ps1.: Varargs must be describe as an array. ps2.: It is not necessary to describe generics. ps3.: put S: for static methods. Example: S:M:Main.main(String[])

resolveDependences

public void resolveDependences()
Description copied from interface: DesignIF
Resolve all dependences between entities after extraction.

Specified by:
resolveDependences in interface DesignIF

containsEntity

public boolean containsEntity(java.lang.String entityName)
Verifies if this design has a entity with the parameter entityName.

Specified by:
containsEntity in interface DesignIF
Parameters:
entityName - the name of the entity.
Returns:
true if the entity with the name equals the parameter exists in this Design or false if not.

setVisibility

public void setVisibility(java.lang.String entityName,
                          Modifier visibility)
                   throws InexistentEntityException
Returns a set containing all classes extracted.

Specified by:
setVisibility in interface DesignIF
Throws:
InexistentEntityException

setReturnType

public void setReturnType(java.lang.String method,
                          java.lang.String returnType)
                   throws InexistentEntityException
Description copied from interface: DesignIF
Put the retunrType value on return type of the specified method.

Specified by:
setReturnType in interface DesignIF
Throws:
InexistentEntityException

setParameters

public void setParameters(java.lang.String method,
                          java.lang.String parameters)
                   throws InexistentEntityException
Specified by:
setParameters in interface DesignIF
Throws:
InexistentEntityException

getEntity

public Entity getEntity(java.lang.String entityName)
                 throws InexistentEntityException
Method that return the entity with the specified name.

Specified by:
getEntity in interface DesignIF
Parameters:
entityName - the name of the entity to be looked for.
Returns:
the entity with the specified name.
Throws:
InexistentEntityException

getClass

public ClassNode getClass(java.lang.String className)
                   throws InexistentEntityException
Returns a ClassEntity represented by the specified className.

Specified by:
getClass in interface DesignIF
Parameters:
className - - the name of the class.
Returns:
a ClassEntity represented by the specified className.
Throws:
InexistentEntityException

getMethod

public MethodNode getMethod(java.lang.String methodName)
                     throws InexistentEntityException
Returns a Method with the specified name.

Specified by:
getMethod in interface DesignIF
Parameters:
methodName - the name of the method.
Returns:
a Method with the specified name.
Throws:
InexistentEntityException

getField

public FieldNode getField(java.lang.String fieldName)
                   throws InexistentEntityException
Returns a Field with the specified name.

Specified by:
getField in interface DesignIF
Parameters:
fieldName - the name of the field.
Returns:
a Field with the specified name.
Throws:
InexistentEntityException

getAllClassesFromCode

public java.util.Set<ClassNode> getAllClassesFromCode()
Returns all the classes from the application's code

Specified by:
getAllClassesFromCode in interface DesignIF

getAllClasses

public java.util.Set<ClassNode> getAllClasses()
Returns a Set of ClassNode objects representing all classes extracted. This includes those classes from java and libraries used by the code extracted. Realize that classes from java are not entirely extracted. If you need only the classes from your source code, you must call the designwizard.design.Design#getAllClassesFromCode().

Returns:
a Set of ClassNode objects representing all the classes extracted.

toString

public java.lang.String toString()
A String representation for this Design.

Overrides:
toString in class java.lang.Object

getAllPackagesFromCode

public java.util.Set<PackageNode> getAllPackagesFromCode()
Specified by:
getAllPackagesFromCode in interface DesignIF

getPackage

public PackageNode getPackage(java.lang.String fullyQualifiedNamePackage)
                       throws InexistentEntityException
Specified by:
getPackage in interface DesignIF
Throws:
InexistentEntityException

getAllMethods

public java.util.Set<MethodNode> getAllMethods()