|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.eugene.models.object.ObjectModelBuilder
org.nuiton.eugene.java.JavaBuilder
public class JavaBuilder
JavaBuilder
Created: 29 oct. 2009 Builder to fill an empty ObjectModel with java specificities (imports, only one inheritance, constructor, ...). JavaBuilder uses some extensions to manage imports , constants, annotations, ...in the model. JavaBuilder is also based on ObjectModelBuilder for the simple filling of the model.
| Field Summary | |
|---|---|
protected AnnotationsManagerExtension |
annotationsManagerExtension
ObjectModel extension to manage imports : one ImportsManager by classifier |
protected CodesManagerExtension |
codesManagerExtension
ObjectModel extension to manage operation boby codes |
protected ConstantsManagerExtension |
constantsManagerExtension
ObjectModel extension to manage constants : one ConstantsManager for all |
protected ImportsManagerExtension |
importsManagerExtension
ObjectModel extension to manage imports : one ImportsManager by classifier |
| Fields inherited from class org.nuiton.eugene.models.object.ObjectModelBuilder |
|---|
model |
| Constructor Summary | |
|---|---|
JavaBuilder(String modelName)
|
|
| Method Summary | |
|---|---|
void |
addAnnotation(ObjectModelClassifier classifier,
ObjectModelElement element,
String annotation)
Add an annotation on an element of a classifier. |
ObjectModelAttribute |
addAttribute(ObjectModelClassifier classifier,
ObjectModelAttribute attribute)
Add a new attribute to a classifier from an existing attribute. |
ObjectModelAttribute |
addAttribute(ObjectModelClassifier classifier,
String name,
String type)
Add a new attribute to a classifier with no default value. |
ObjectModelAttribute |
addAttribute(ObjectModelClassifier classifier,
String name,
String type,
String value,
ObjectModelModifier... modifiers)
Add a new attribute to a classifier. |
ObjectModelOperation |
addBlock(ObjectModelClassifier classifier,
ObjectModelModifier... modifiers)
Add a new block to a classifier. |
void |
addBodyCode(ObjectModelClassifier classifier,
ObjectModelOperation operation,
String code)
Add a body code to the operation of a classifier. |
ObjectModelAttribute |
addConstant(ObjectModelClassifier classifier,
String name,
String type,
String value,
ObjectModelModifier visibility)
Add a new constant to a classifier. |
ObjectModelOperation |
addConstructor(ObjectModelClass clazz,
ObjectModelModifier visibility)
Add a constructor to a class. |
ObjectModelOperation |
addConstructor(ObjectModelEnumeration enumeration,
ObjectModelModifier visibility)
Add a constructor to a enumeration. |
protected ObjectModelOperation |
addConstructorForClassifier(ObjectModelClassifier classifier,
ObjectModelModifier visibility)
|
void |
addException(ObjectModelOperation operation,
String exception)
Add an exception to an operation. |
void |
addImport(ObjectModelClassifier classifier,
String imports)
Add an import to a classifier. |
void |
addInterface(ObjectModelClassifier classifier,
String interfaceQualifiedName)
Add an interface to a classifier (interface, class, enum). |
ObjectModelOperation |
addOperation(ObjectModelClassifier classifier,
String name,
String type,
ObjectModelModifier... modifiers)
Add a new operation to a classifier. |
ObjectModelParameter |
addParameter(ObjectModelOperation operation,
String type,
String name)
Add a new parameter to an existing operation. |
void |
addSuperclass(ObjectModelClass clazz,
String superclassQualifiedName)
Add a superclass to an other class. |
ObjectModelClass |
createAbstractClass(String name,
String packageName)
Create a new abstract class in the model. |
String |
getConstantName(String propertyName)
Converts the given propertyName to a constant name. |
void |
setOperationBody(ObjectModelOperation operation,
String body)
Set the operation body code. |
void |
setSuperClass(ObjectModelClass classifier,
String superclassQualifiedName)
Set the superclass of an other class. |
| Methods inherited from class org.nuiton.eugene.models.object.ObjectModelBuilder |
|---|
addAssociation, addComment, addInnerClassifier, addLiteral, addOperation, addReverseAssociation, addStereotype, addTagValue, addTagValue, createAssociationClass, createClass, createClass, createEnumeration, createInterface, getModel, setClassModifiers, setDocumentation, setMaxMultiplicity, setMinMultiplicity, setNavigable |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ImportsManagerExtension importsManagerExtension
protected AnnotationsManagerExtension annotationsManagerExtension
protected ConstantsManagerExtension constantsManagerExtension
protected CodesManagerExtension codesManagerExtension
| Constructor Detail |
|---|
public JavaBuilder(String modelName)
| Method Detail |
|---|
public void addInterface(ObjectModelClassifier classifier,
String interfaceQualifiedName)
addInterface in class ObjectModelBuilderclassifier - the classifier on which to add the interfaceinterfaceQualifiedName - fully qualified name of the interface
public void addSuperclass(ObjectModelClass clazz,
String superclassQualifiedName)
throws UnsupportedOperationException
ObjectModelBuilder
addSuperclass in class ObjectModelBuilderclazz - where the superclass will be addedsuperclassQualifiedName - superclass qualified name
UnsupportedOperationException
public ObjectModelAttribute addAttribute(ObjectModelClassifier classifier,
String name,
String type,
String value,
ObjectModelModifier... modifiers)
addAttribute in class ObjectModelBuilderclassifier - the classifier on which to add the attributename - name of attributetype - type of attributevalue - initializer value of attributemodifiers - modifiers of the attribute
ObjectModelModifier.isVisibility()
public ObjectModelAttribute addAttribute(ObjectModelClassifier classifier,
String name,
String type)
addAttribute in class ObjectModelBuilderclassifier - the classifier on which add the attributename - name of the attributetype - type of the attribute
public ObjectModelOperation addOperation(ObjectModelClassifier classifier,
String name,
String type,
ObjectModelModifier... modifiers)
addOperation in class ObjectModelBuilderclassifier - the classifier on which to add the operationname - the name of the operationtype - the return type of the operationmodifiers - the modifiers of the operation
public ObjectModelParameter addParameter(ObjectModelOperation operation,
String type,
String name)
addParameter in class ObjectModelBuilderoperation - the operation on which to add a parametertype - the type of the parametername - the name of the parameter
public void addException(ObjectModelOperation operation,
String exception)
addException in class ObjectModelBuilderoperation - the operation on which to add a execeptionexception - the exception to add
public void setOperationBody(ObjectModelOperation operation,
String body)
throws IllegalArgumentException
setOperationBody in class ObjectModelBuilderoperation - the operation on which to add the body codebody - the body code to set on the operation
IllegalArgumentException - if operation is abstract
public ObjectModelClass createAbstractClass(String name,
String packageName)
name - the name of the abstract class to createpackageName - package's name of the class to create
ObjectModelBuilder.createClass(String, String, ObjectModelModifier...)
public void addImport(ObjectModelClassifier classifier,
String imports)
You can have some complex imports like : - new java.util.List() --> two imports 'java.util.List' and 'org.chorem.bonzoms.Role' - java.util.Collection --> two imports 'java.util.Collection' and 'org.nuiton.topia.TopiaEntity'
classifier - where the imports will be added.imports - to addGeneratorUtil.getTypesList(String)
public void addAnnotation(ObjectModelClassifier classifier,
ObjectModelElement element,
String annotation)
classifier - where the annotation will be added.element - element on which add annotationannotation - annotation to add
public void setSuperClass(ObjectModelClass classifier,
String superclassQualifiedName)
classifier - the classifier on which to set the super classsuperclassQualifiedName - fully qualified name of the super class
public ObjectModelAttribute addConstant(ObjectModelClassifier classifier,
String name,
String type,
String value,
ObjectModelModifier visibility)
throws IllegalArgumentException
classifier - the classifier on which to add the constant fieldname - name of the constant fieldtype - type of the constant fieldvalue - initializer value of the constant fieldvisibility - modifier allowed : PUBLIC, PRIVATE, PROTECTED, PACKAGE
IllegalArgumentException - if the modifier is not a visibility
public void addBodyCode(ObjectModelClassifier classifier,
ObjectModelOperation operation,
String code)
classifier - where the body code will be added.operation - operation on which add body codecode - code to addpublic String getConstantName(String propertyName)
propertyName to a constant name.
For example :
"CONSTANT_A" = getConstantName("constantA");
propertyName - the name of the property to convert
public ObjectModelAttribute addAttribute(ObjectModelClassifier classifier,
ObjectModelAttribute attribute)
classifier - the classifier on which to add the attributeattribute - the attribute to add
public ObjectModelOperation addBlock(ObjectModelClassifier classifier,
ObjectModelModifier... modifiers)
classifier - the classifier on which to add the blockmodifiers - the modifiers of the operation
ObjectModelBuilder.addOperation(ObjectModelClassifier, String, String, ObjectModelModifier...)
public ObjectModelOperation addConstructor(ObjectModelClass clazz,
ObjectModelModifier visibility)
throws IllegalArgumentException
clazz - the classifier on which to add the constructorvisibility - the visibility of the operation
IllegalArgumentException - if the modifier is not a visibility
public ObjectModelOperation addConstructor(ObjectModelEnumeration enumeration,
ObjectModelModifier visibility)
throws IllegalArgumentException
enumeration - the enumeration on which to add the constructorvisibility - the visibility of the constructor (should always to private...)
IllegalArgumentException - if visibility is not ok
protected ObjectModelOperation addConstructorForClassifier(ObjectModelClassifier classifier,
ObjectModelModifier visibility)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||