|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.ashridgetech.jamda.code.ClassGenerator
|
+--com.ashridgetech.jamda.code.UmlTypeGenerator
|
+--com.ashridgetech.jamda.code.UmlClassGenerator
Code generator which generates a Java class with the exact features
of a UML ClassType. It must configured with
MethodCoderFactory objects using setMethodCoderFactory(Stereotype,MethodCoderFactory)
or setMethodCoderFactory(String,MethodCoderFactory)to create the method body statements.
This may be done in a subclass's constructor or by a client class.
Each instance may only be used to generate one class.
| Nested Class Summary |
| Nested classes inherited from class com.ashridgetech.jamda.code.ClassGenerator |
ClassGenerator.FieldGenerator, ClassGenerator.MethodGenerator, ClassGenerator.PropertyDetails |
| Field Summary |
| Fields inherited from class com.ashridgetech.jamda.code.UmlTypeGenerator |
createDone |
| Fields inherited from class com.ashridgetech.jamda.code.ClassGenerator |
ABSTRACT, FINAL, PACKAGE, PRIVATE, PROTECTED, PUBLIC, READ_ONLY, READ_WRITE, STATIC, SYNCHRONIZED, TRANSIENT, VOLATILE |
| Constructor Summary | |
UmlClassGenerator(ClassType source)
Construct a ClassGenerator. |
|
| Method Summary | |
int |
findModifiers()
Work out the Java modifiers needed for this generator's ClassType. |
protected java.util.Collection |
getExtraImports()
Get any extra imports not catered for by UmlTypeGenerator.findImports(). |
MethodCoder |
getMethodCoder(Operation operation)
Get the MethodCoder which will be used for an Operation. |
MethodCoderFactory |
getMethodCoderFactory(Stereotype stereotype)
Get the MethodCoderFactory which will be used for Operations
with a particular Stereotype. |
MethodCoderFactory |
getMethodCoderFactory(java.lang.String operationName)
Get the MethodCoderFactory which will be used for Operations
with a particular name. |
ClassType |
getUmlClass()
Get the UML Class which is the source for the generation. |
UmlClassGenerator |
setMethodCoderFactory(Stereotype stereotype,
MethodCoderFactory factory)
Set the MethodCoderFactory which will be used to create
MethodCoders for Operations
with a particular Stereotype. |
UmlClassGenerator |
setMethodCoderFactory(java.lang.String operationName,
MethodCoderFactory factory)
Set the MethodCoderFactory which will be used to create
MethodCoders for Operations with a particular name. |
protected void |
setup()
Set up the generator characteristics. |
protected ClassGenerator.MethodGenerator |
setupMethod(Operation op)
Set up a method from an Operation or Constructor. |
| Methods inherited from class com.ashridgetech.jamda.code.UmlTypeGenerator |
addOperationImports, findImports, findModifiers, generate, getDirectory, getFileWriter, getSource, setDirectory |
| Methods inherited from class com.ashridgetech.jamda.code.ClassGenerator |
addConstructor, addExtends, addExtends, addExtends, addField, addField, addImplements, addImplements, addImplements, addImport, addImportClass, addImportPackage, addMethod, addProperty, addProperty, checkReadyToGenerate, classDecl, classDoc, constructors, doGenerate, endClass, fields, fileHeader, getClassDoc, getClassModifiers, getClassName, getExtendsNames, getFileName, getImplementsNames, getImportNames, getPackageName, getWriter, imports, isInterface, logger, makeClassWriter, methods, packageDecl, setClassDoc, setClassModifiers, setClassName, setPackageName, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public UmlClassGenerator(ClassType source)
ClassGenerator.
| Method Detail |
public ClassType getUmlClass()
protected void setup()
ClassType set in the constructor.
setup in class UmlTypeGeneratorprotected ClassGenerator.MethodGenerator setupMethod(Operation op)
Operation or Constructor.
setupMethod in class UmlTypeGeneratorop - the Operation or Constructor
to set uppublic MethodCoderFactory getMethodCoderFactory(Stereotype stereotype)
MethodCoderFactory which will be used for Operations
with a particular Stereotype. This must have been added using
setMethodCoderFactory(Stereotype,MethodCoderFactory).
stereotype - the Stereotype for which the MethodCoder
is required
MethodCoderFactory or null if there is no factory set
for stereotype
public UmlClassGenerator setMethodCoderFactory(Stereotype stereotype,
MethodCoderFactory factory)
MethodCoderFactory which will be used to create
MethodCoders for Operations
with a particular Stereotype.
stereotype - the Stereotype for which factory
will be used - may not be nullfactory - the MethodCoderFactory to use - may not be null
public MethodCoderFactory getMethodCoderFactory(java.lang.String operationName)
MethodCoderFactory which will be used for Operations
with a particular name. This must have been added using
setMethodCoderFactory(String,MethodCoderFactory).
operationName - the name of the Operations for which
the coder will be used
MethodCoderFactory or null if there is no factory set
for operationNamesetMethodCoderFactory(String,MethodCoderFactory)
public UmlClassGenerator setMethodCoderFactory(java.lang.String operationName,
MethodCoderFactory factory)
MethodCoderFactory which will be used to create
MethodCoders for Operations with a particular name.
operationName - the name of the Operations for which coder
will be used - may not be nullfactory - the MethodCoderFactory to use - may not be null
setMethodCoderFactory(Stereotype, MethodCoderFactory)public MethodCoder getMethodCoder(Operation operation)
MethodCoder which will be used for an Operation.
If there is Java code already specified for the Operation,
a coder is returned which will generate this code.
Then the method looks for the MethodCoderFactory for one of the operations stereotypes
using getMethodCoderFactory(Stereotype), then if this is not found,
it looks for the factory for the operation name using getMethodCoderFactory(String).
If the operation has more than one stereotype, the first one found for
which a factory has been set will be used.
operation - the Operation for which the coder is required
MethodCoder or null if there is no coder availablepublic int findModifiers()
ClassType.
XXX cannot currently handle FINAL and STATIC
findModifiers in class UmlTypeGeneratorprotected java.util.Collection getExtraImports()
UmlTypeGenerator.findImports().
This implementation returns the imports needed for Constructors,
Attributes and the interfaces implemented.
getExtraImports in class UmlTypeGeneratorCollection of import types
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||