|
|||||||||||
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
Superclass for Java code generators which generate a Java class or interface
with features corresponding to those of a StructuredType
.
Contains common functionality for its subclasses.
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 | |
(package private) boolean |
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 | |
protected |
UmlTypeGenerator(StructuredType source)
Construct a UmlTypeGenerator attached to a StructuredType . |
Method Summary | |
protected static void |
addOperationImports(java.util.Collection operationColl,
java.util.Set importSet)
Add the imports for a set of Operation 's parameters to a given Set . |
protected java.util.Set |
findImports()
Work out the types used by attributes and operation parameters, extended and implemented types by this generator's StructuredType . |
int |
findModifiers()
Work out the Java modifiers needed for this generator's StructuredType . |
static int |
findModifiers(Feature feature)
Work out the Java modifiers needed for a Attribute or Operation . |
void |
generate(java.io.Writer writer)
Override the superclass method to call setup() before generating. |
java.io.File |
getDirectory()
Get the top level directory for the output files. |
protected java.util.Collection |
getExtraImports()
Get any extra imports not catered for by findImports() . |
java.io.Writer |
getFileWriter()
Get a writer for the appropriate output file. |
StructuredType |
getSource()
Get the UML StructuredType which is the source for the generation. |
void |
setDirectory(java.io.File directory)
Set the the top level directory for the output files. |
protected void |
setup()
|
protected ClassGenerator.MethodGenerator |
setupMethod(Operation op)
Set up a method from an Operation or Constructor . |
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 |
Field Detail |
boolean createDone
Constructor Detail |
protected UmlTypeGenerator(StructuredType source)
UmlTypeGenerator
attached to a StructuredType
.
source
- the source StructuredType
for which the code is generated - must not be null.
irrespective of whether umlStructuredType
is an InterfaceType
Method Detail |
public java.io.File getDirectory()
public void setDirectory(java.io.File directory)
directory
- top of the package structurepublic StructuredType getSource()
public void generate(java.io.Writer writer) throws java.io.IOException
setup()
before generating.
generate
in class ClassGenerator
writer
- the destination for the generated code
java.lang.IllegalStateException
- if this method has already been called
java.io.IOException
protected void setup()
public java.io.Writer getFileWriter() throws java.io.IOException
Writer
to generate into
java.io.IOException
protected ClassGenerator.MethodGenerator setupMethod(Operation op)
Operation
or Constructor
.
op
- the Operation
or Constructor
to set uppublic int findModifiers()
StructuredType
.
XXX cannot currently handle FINAL
public static int findModifiers(Feature feature)
Attribute
or Operation
.
XXX cannot currently handle FINAL, TRANSIENT, VOLATILE or SYNCHRONIZED
feature
- the Attribute
or Operation
to find modifiers for
protected java.util.Set findImports()
StructuredType
.
Set
of StructuredType
objectsprotected static void addOperationImports(java.util.Collection operationColl, java.util.Set importSet)
Operation
's parameters to a given Set
.
operationColl
- the Operation
s for whcih the imports are needed
protected java.util.Collection getExtraImports()
findImports()
.
This implementation returns an empty Set
. It should
be overridden by subclasses which need to add extra import types.
Collection
of import types
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |