org.designwizard.design
Class AbstractEntity

java.lang.Object
  extended by org.designwizard.design.AbstractEntity
All Implemented Interfaces:
Entity
Direct Known Subclasses:
ClassNode, FieldNode, MethodNode, PackageNode

public abstract class AbstractEntity
extends java.lang.Object
implements Entity

Abstract class that represent the entities of Design.

Author:
Jo�o Arthur Brunet Monteiro - joaoarthurbm@gmail.com

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.designwizard.design.Entity
Entity.TypesOfEntities
 
Field Summary
protected  java.util.Collection<Modifier> modifiers
           
protected  java.lang.String name
           
protected  java.util.Map<Relation.TypesOfRelation,java.util.Set<Relation>> relations
          Attributes The relations Map contains all the relations that this AbstractEntity is the caller.
protected  Entity.TypesOfEntities type
           
 
Constructor Summary
protected AbstractEntity()
           
 
Method Summary
 void addModifier(Modifier modifier)
          This method is used to add a Modifier on this Entity.
 void addModifiers(java.util.Collection<Modifier> modifiers)
          This method is used to add a Collection of Modifier on this Entity.
 void addRelation(Relation relation)
          Adds a relation for this entity.
 boolean containsModifiers(Modifier... modifiers)
          Verifies whether this Entity has the specified modifiers.
 boolean containsRelation(Relation relation)
          Method that verifies if the Entity has the specified relation.
abstract  java.util.Set<ClassNode> getCalleeClasses()
          Returns the classes that are referenced by this Entity.
abstract  java.util.Set<ClassNode> getCallerClasses()
          Returns the classes that reference this Entity.
 java.util.Collection<Modifier> getModifiers()
          Returns the visibility of this Method.
 java.lang.String getName()
          Method that returns the description of this design element.
 java.util.Set<Relation> getRelations(Relation.TypesOfRelation type)
          Method that returns all the relations with the specified type.
 java.lang.String getShortName()
          Returns the short name of this Entity.
 Entity.TypesOfEntities getTypeOfEntity()
          Method that returns the type of this element of design.
 Modifier getVisibility()
          Returns the visibility of this Entity.
 int hashCode()
           
 boolean isAbstract()
          Verifies if this Entity is abstract.
 boolean removeRelation(Relation relation)
          Removes a relation from this Entity.
 java.lang.String toString()
          A String representation for the Entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.designwizard.design.Entity
getCalleeMethods, getCalleePackages, getCallerMethods, getCallerPackages, getClassName, getClassNode, getImpactOfAChange, getPackage
 

Field Detail

relations

protected java.util.Map<Relation.TypesOfRelation,java.util.Set<Relation>> relations
Attributes The relations Map contains all the relations that this AbstractEntity is the caller. The key of the map represents the type of the relation and the object that is mapped for the key is a set of relations of the specified type.


name

protected java.lang.String name

type

protected Entity.TypesOfEntities type

modifiers

protected java.util.Collection<Modifier> modifiers
Constructor Detail

AbstractEntity

protected AbstractEntity()
Method Detail

getShortName

public java.lang.String getShortName()
Description copied from interface: Entity
Returns the short name of this 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.

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

getCalleeClasses

public abstract java.util.Set<ClassNode> getCalleeClasses()
Description copied from interface: Entity
Returns the classes that are referenced by this Entity.

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

getCallerClasses

public abstract java.util.Set<ClassNode> getCallerClasses()
Description copied from interface: Entity
Returns the classes that reference this Entity.

Specified by:
getCallerClasses in interface Entity
Returns:
A set containing all classes that makes reference to this Entity.

getVisibility

public Modifier getVisibility()
Description copied from interface: Entity
Returns the visibility of this Entity.

Specified by:
getVisibility in interface Entity
Returns:

addRelation

public void addRelation(Relation relation)
Adds a relation for this entity.

Specified by:
addRelation in interface Entity
Parameters:
relation - the relation to be added.

removeRelation

public boolean removeRelation(Relation relation)
Removes a relation from this Entity.

Specified by:
removeRelation in interface Entity
Parameters:
Relation - the relation to be removed.
Returns:
true if this Entity contains the specified relation.

getName

public java.lang.String getName()
Method that returns the description of this design element.

Specified by:
getName in interface Entity
Returns:
a String representation for this element of design.

getTypeOfEntity

public Entity.TypesOfEntities getTypeOfEntity()
Method that returns the type of this element of design.

Specified by:
getTypeOfEntity in interface Entity
Returns:
the type of this element of design.

addModifier

public void addModifier(Modifier modifier)
Description copied from interface: Entity
This method is used to add a Modifier on this Entity.

Specified by:
addModifier in interface Entity

addModifiers

public void addModifiers(java.util.Collection<Modifier> modifiers)
Description copied from interface: Entity
This method is used to add a Collection of Modifier on this Entity.

Specified by:
addModifiers in interface Entity

containsModifiers

public boolean containsModifiers(Modifier... modifiers)
Description copied from interface: Entity
Verifies whether this Entity has the specified modifiers.

Specified by:
containsModifiers in interface Entity
Returns:
true if this Entity has the specified modifiers or false otherwise.

getModifiers

public java.util.Collection<Modifier> getModifiers()
Returns the visibility of this Method.

Specified by:
getModifiers in interface Entity
Returns:
the visibility of this Method.

containsRelation

public boolean containsRelation(Relation relation)
Method that verifies if the Entity has the specified relation.

Specified by:
containsRelation in interface Entity
Parameters:
relation - the relation to be verified.
Returns:
true if the specified relation is on this entity or false if not.

getRelations

public java.util.Set<Relation> getRelations(Relation.TypesOfRelation type)
Method that returns all the relations with the specified type.

Specified by:
getRelations in interface Entity
Parameters:
type - the type of the relation.
Returns:
A Collection containing all the relations with the specified type. If there is no Relation of the specified type, an empty Set will be returned.

isAbstract

public boolean isAbstract()
Description copied from interface: Entity
Verifies if this Entity is abstract.

Specified by:
isAbstract in interface Entity
Returns:
true if this Entity is abstract; false otherwise.

toString

public java.lang.String toString()
A String representation for the Entity.

Overrides:
toString in class java.lang.Object
Returns:
A string representation for the entities.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object