|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.eugene.models.object.ObjectModelBuilder
public class ObjectModelBuilder
Builder to fill an empty ObjectModel. The object model name is important if you want to use the model in generators.
Created: 3 nov. 2009
| Field Summary | |
|---|---|
protected ObjectModelImpl |
model
|
| Constructor Summary | |
|---|---|
ObjectModelBuilder(String name)
Constructor. |
|
| Method Summary | |
|---|---|
ObjectModelAttribute |
addAssociation(ObjectModelClassifier classifierA,
ObjectModelClassifier classifierB,
String roleName,
int minMultiplicity,
int maxMultiplicity,
ObjectModelModifier... modifiers)
Add an association A to B. |
ObjectModelAttribute |
addAttribute(ObjectModelClassifier classifier,
String name,
String type)
Add an attribute to a classifier (interface, class, enum) without default value. |
ObjectModelAttribute |
addAttribute(ObjectModelClassifier classifier,
String name,
String type,
String value,
ObjectModelModifier... modifiers)
Add an attribute to a classifier (interface, class, enum). |
void |
addComment(ObjectModelElement element,
String comment)
Add a comment to an element. |
void |
addException(ObjectModelOperation operation,
String exception)
Add an exception to an operation. |
ObjectModelClassifier |
addInnerClassifier(ObjectModelClass clazz,
ObjectModelType type,
String name,
ObjectModelModifier... modifiers)
Add a superclass to an other class. |
void |
addInterface(ObjectModelClassifier classifier,
String interfaceQualifiedName)
Add an interface to a classifier. |
void |
addLiteral(ObjectModelEnumeration enumz,
String name)
|
ObjectModelOperation |
addOperation(ObjectModelClassifier classifier,
ObjectModelOperation operation)
Add an operation to a classifier. |
ObjectModelOperation |
addOperation(ObjectModelClassifier classifier,
String name,
String returnType,
ObjectModelModifier... modifiers)
Add an operation to a classifier. |
ObjectModelParameter |
addParameter(ObjectModelOperation operation,
String type,
String name)
Add a parameter to an operation. |
ObjectModelAttribute |
addReverseAssociation(ObjectModelAttribute attrAssociation,
String roleName,
int minMultiplicity,
int maxMultiplicity,
ObjectModelModifier... modifiers)
Create reverse association from an other association. |
void |
addStereotype(ObjectModelElement element,
String stereotype)
Add a stereotype to an element. |
void |
addSuperclass(ObjectModelClass clazz,
String superclassQualifiedName)
Add a superclass to an other class. |
void |
addTagValue(ObjectModelElement element,
String name,
String value)
Add a tagValue to an element |
void |
addTagValue(String name,
String value)
Add a tagValue to the model. |
ObjectModelAssociationClass |
createAssociationClass(String name,
String packageName,
ObjectModelAttribute attrAssociationA,
ObjectModelAttribute attrAssociationB,
ObjectModelModifier... modifiers)
Create association class. |
protected ObjectModelClass |
createClass(ObjectModelClassImpl clazz,
String name,
String packageName,
ObjectModelModifier... modifiers)
|
ObjectModelClass |
createClass(String name,
String packageName,
ObjectModelModifier... modifiers)
Create a new class in the model. |
ObjectModelEnumeration |
createEnumeration(String name,
String packageName)
Create a new interface in the model. |
ObjectModelInterface |
createInterface(String name,
String packageName)
Create a new interface in the model. |
ObjectModel |
getModel()
Get the building model |
protected void |
setClassModifiers(ObjectModelClassImpl clazz,
ObjectModelModifier... modifiers)
Set modifiers to a class. |
void |
setDocumentation(ObjectModelElement element,
String documentation)
Set the documentation of an element in the model. |
void |
setMaxMultiplicity(ObjectModelAttribute attribute,
int multiplicity)
Set the max multiplicity of an attribute in the model. |
void |
setMinMultiplicity(ObjectModelAttribute attribute,
int multiplicity)
Set the min multiplicity of an attribute in the model. |
void |
setNavigable(ObjectModelAttribute attribute,
boolean navigable)
Set the navigable flag of an attribute in the model. |
void |
setOperationBody(ObjectModelOperation operation,
String body)
Set the body code for an Operation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ObjectModelImpl model
| Constructor Detail |
|---|
public ObjectModelBuilder(String name)
name - model name| Method Detail |
|---|
public ObjectModel getModel()
public void addTagValue(String name,
String value)
name - tagValue namevalue - tagValue value
public void addTagValue(ObjectModelElement element,
String name,
String value)
element - where the tag value will be addedname - tagValue namevalue - tagValue value
public ObjectModelClass createClass(String name,
String packageName,
ObjectModelModifier... modifiers)
name - class namepackageName - class packagemodifiers - class modifiers
protected ObjectModelClass createClass(ObjectModelClassImpl clazz,
String name,
String packageName,
ObjectModelModifier... modifiers)
throws IllegalArgumentException
IllegalArgumentException
protected void setClassModifiers(ObjectModelClassImpl clazz,
ObjectModelModifier... modifiers)
throws IllegalArgumentException
clazz - ObjectModelClassImpl where modifiers will be setmodifiers - Array of ObjectModelModifier to set
IllegalArgumentException - for unsupported modifier
public ObjectModelInterface createInterface(String name,
String packageName)
name - interface namepackageName - interface package
public ObjectModelEnumeration createEnumeration(String name,
String packageName)
name - interface namepackageName - interface package
public ObjectModelAttribute addAttribute(ObjectModelClassifier classifier,
String name,
String type)
classifier - where the attribute will be addedname - attribute nametype - attribute type (full qualified name)
public ObjectModelAttribute addAttribute(ObjectModelClassifier classifier,
String name,
String type,
String value,
ObjectModelModifier... modifiers)
throws IllegalArgumentException
classifier - where the attribute will be addedname - attribute nametype - attribute type (full qualified name)value - default value for the attributemodifiers - attribute modifiers
IllegalArgumentException - illegal ModifierObjectModelModifier.isVisibility()
public ObjectModelAttribute addAssociation(ObjectModelClassifier classifierA,
ObjectModelClassifier classifierB,
String roleName,
int minMultiplicity,
int maxMultiplicity,
ObjectModelModifier... modifiers)
throws IllegalArgumentException
addReverseAssociation(ObjectModelAttribute, String, int, int, ObjectModelModifier...)
to create attribute association for classifierB.
classifierA - classifier fromclassifierB - classifier toroleName - role of A in associationminMultiplicity - minimum multiplicity of A in associationmaxMultiplicity - maximum multiplicity of A in associationmodifiers - for the association
IllegalArgumentException - illegal modifier
public ObjectModelAttribute addReverseAssociation(ObjectModelAttribute attrAssociation,
String roleName,
int minMultiplicity,
int maxMultiplicity,
ObjectModelModifier... modifiers)
attrAssociation - other association A to BroleName - role of B in associationminMultiplicity - minimum multiplicity of B in associationmaxMultiplicity - maximum multiplicity of B in associationmodifiers - for the association
addAssociation(ObjectModelClassifier, ObjectModelClassifier, String, int, int, ObjectModelModifier...)
public ObjectModelAssociationClass createAssociationClass(String name,
String packageName,
ObjectModelAttribute attrAssociationA,
ObjectModelAttribute attrAssociationB,
ObjectModelModifier... modifiers)
name - association class namepackageName - association package nameattrAssociationA - attribute association for classifierA involved in association classattrAssociationB - attribute association for classifierB involved in association classmodifiers - for the association class
public ObjectModelOperation addOperation(ObjectModelClassifier classifier,
String name,
String returnType,
ObjectModelModifier... modifiers)
throws IllegalArgumentException
classifier - where the operation will be addedname - operation namereturnType - operation type (full qualified name)modifiers - operation modifiers
IllegalArgumentException - illegal Modifier
public ObjectModelOperation addOperation(ObjectModelClassifier classifier,
ObjectModelOperation operation)
classifier - where the operation will be addedoperation - operation to add
public void setOperationBody(ObjectModelOperation operation,
String body)
operation - where the code will be addedbody - code to add to the operation
public void addInterface(ObjectModelClassifier classifier,
String interfaceQualifiedName)
classifier - where the interface will be addedinterfaceQualifiedName - interface qualified name
public void addSuperclass(ObjectModelClass clazz,
String superclassQualifiedName)
clazz - where the superclass will be addedsuperclassQualifiedName - superclass qualified name
public ObjectModelClassifier addInnerClassifier(ObjectModelClass clazz,
ObjectModelType type,
String name,
ObjectModelModifier... modifiers)
throws IllegalArgumentException
clazz - where the superclass will be addedtype - type of inner classifier to createname - superclass qualified namemodifiers - modifiers of the inner classifier
IllegalArgumentException - if given type is not a concrete classifier type
public ObjectModelParameter addParameter(ObjectModelOperation operation,
String type,
String name)
operation - where the parameter will be addedtype - paremeter type (full qualified name)name - parameter name
public void addException(ObjectModelOperation operation,
String exception)
operation - where the exception will be addedexception - name of the exception (full qualified name)
public void setDocumentation(ObjectModelElement element,
String documentation)
element - where the documentation will be setteddocumentation - String documentation for the element
public void addStereotype(ObjectModelElement element,
String stereotype)
element - where the stereotype will be addedstereotype - name
public void addLiteral(ObjectModelEnumeration enumz,
String name)
public void addComment(ObjectModelElement element,
String comment)
element - where the comment will be addedcomment - comment to add
public void setMinMultiplicity(ObjectModelAttribute attribute,
int multiplicity)
attribute - where the multiplicity will be settedmultiplicity - String description for the element
public void setMaxMultiplicity(ObjectModelAttribute attribute,
int multiplicity)
attribute - where the multiplicity will be settedmultiplicity - String description for the element
public void setNavigable(ObjectModelAttribute attribute,
boolean navigable)
attribute - where the navigable flag will be settednavigable - navigable flag value to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||