|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.argouml.uml.generator.Generator
org.argouml.language.java.generator.GeneratorJava
Generator subclass to generate text for display in diagrams in in text fields in the Argo/UML user interface. The generated code looks a lot like (invalid) Java. The idea is that other generators could be written for outher languages. This code is just a placeholder for future development, I expect it to be totally replaced.
Field Summary | |
protected boolean |
_lfBeforeCurly
|
protected boolean |
_verboseDocs
|
static java.lang.String |
ANY_RANGE
|
Fields inherited from class org.argouml.uml.generator.Generator |
INDENT, TEST_SUFFIX |
Fields inherited from interface org.argouml.uml.generator.FileGenerator |
FILE_SEPARATOR |
Fields inherited from interface org.argouml.application.api.Pluggable |
PLUGIN_PREFIX, PLUGIN_TITLE, PLUGIN_VENDOR |
Fields inherited from interface org.argouml.application.api.ArgoModule |
cat, MODULEFILENAME, MODULEFILENAME_ALTERNATE |
Constructor Summary | |
protected |
GeneratorJava()
|
Method Summary | |
boolean |
canParse()
Can the notation be parsed at all? |
boolean |
canParse(java.lang.Object o)
Can the notation be parsed for this object? |
static java.lang.String |
Generate(java.lang.Object o)
|
java.lang.String |
generateAbstractness(ru.novosoft.uml.foundation.core.MOperation op)
Generate "abstract" keyword for an abstract operation. |
java.lang.String |
generateAction(java.lang.Object m)
|
java.lang.String |
generateAscEndName(ru.novosoft.uml.foundation.core.MAssociationEnd ae)
|
java.lang.String |
generateAssociation(ru.novosoft.uml.foundation.core.MAssociation a)
|
java.lang.String |
generateAssociationEnd(ru.novosoft.uml.foundation.core.MAssociationEnd ae)
|
java.lang.String |
generateAssociationFrom(ru.novosoft.uml.foundation.core.MAssociation a,
ru.novosoft.uml.foundation.core.MAssociationEnd ae)
|
java.lang.String |
generateAssociationRole(ru.novosoft.uml.behavior.collaborations.MAssociationRole m)
|
java.lang.String |
generateAttribute(ru.novosoft.uml.foundation.core.MAttribute attr,
boolean documented)
|
java.lang.String |
generateChangability(ru.novosoft.uml.foundation.core.MStructuralFeature sf)
|
java.lang.String |
generateChangeability(ru.novosoft.uml.foundation.core.MOperation op)
Generate "final" keyword for final operations. |
java.lang.String |
generateClassifier(ru.novosoft.uml.foundation.core.MClassifier cls)
Generates code for a classifier. |
protected java.lang.StringBuffer |
generateClassifierBody(ru.novosoft.uml.foundation.core.MClassifier cls)
Generates the body of a class or interface. |
protected java.lang.StringBuffer |
generateClassifierEnd(ru.novosoft.uml.foundation.core.MClassifier cls)
|
java.lang.String |
generateClassList(java.util.Collection classifiers)
|
java.lang.String |
generateConcurrency(ru.novosoft.uml.foundation.core.MOperation op)
Generates "synchronized" keyword for guarded operations. |
java.lang.String |
generateConstraint(ru.novosoft.uml.foundation.core.MConstraint c)
|
static java.lang.String |
generateConstraintEnrichedDocComment(ru.novosoft.uml.foundation.core.MModelElement me,
boolean documented,
java.lang.String indent)
Enhance/Create the doccomment for the given model element, including tags for any OCL constraints connected to the model element. |
java.lang.String |
generateConstraintEnrichedDocComment(ru.novosoft.uml.foundation.core.MModelElement me,
ru.novosoft.uml.foundation.core.MAssociationEnd ae)
Enhance/Create the doccomment for the given model element, including tags for any OCL constraints connected to the model element. |
java.lang.String |
generateConstraints(ru.novosoft.uml.foundation.core.MModelElement me)
|
java.lang.String |
generateCoreAssociationEnd(ru.novosoft.uml.foundation.core.MAssociationEnd ae)
|
java.lang.String |
generateCoreAttribute(ru.novosoft.uml.foundation.core.MAttribute attr)
|
java.lang.String |
generateDefaultReturnStatement(ru.novosoft.uml.foundation.core.MClassifier cls)
|
java.lang.String |
generateExtensionPoint(ru.novosoft.uml.behavior.use_cases.MExtensionPoint ep)
Generate code for an extension point. |
java.lang.String |
GenerateFile(java.lang.Object me,
java.lang.String path)
Generates a file for the classifier. |
java.lang.String |
generateGeneralization(java.util.Collection generalizations)
|
java.lang.String |
generateGuard(ru.novosoft.uml.behavior.state_machines.MGuard m)
|
java.lang.String |
generateHeader(ru.novosoft.uml.foundation.core.MClassifier cls,
java.lang.String pathname,
java.lang.String packagePath)
|
java.lang.String |
generateImports(ru.novosoft.uml.foundation.core.MClassifier cls,
java.lang.String packagePath)
|
java.lang.String |
generateImportType(ru.novosoft.uml.foundation.core.MClassifier type,
java.lang.String exclude)
|
java.lang.String |
generateMessage(ru.novosoft.uml.behavior.collaborations.MMessage m)
|
java.lang.String |
generateMethodBody(ru.novosoft.uml.foundation.core.MOperation op)
Generate the body of a method associated with the given operation. |
java.lang.String |
generateMultiplicity(ru.novosoft.uml.foundation.data_types.MMultiplicity m)
|
java.lang.String |
generateMultiplicityRange(ru.novosoft.uml.foundation.data_types.MMultiplicityRange mr)
|
java.lang.String |
generateOperation(ru.novosoft.uml.foundation.core.MOperation op,
boolean documented)
|
java.lang.String |
generatePackage(ru.novosoft.uml.model_management.MPackage p)
|
java.lang.String |
generateParameter(ru.novosoft.uml.foundation.core.MParameter param)
|
java.lang.String |
generateScope(ru.novosoft.uml.foundation.core.MFeature f)
|
java.lang.String |
generateSpecification(ru.novosoft.uml.foundation.core.MClass cls)
|
java.lang.String |
generateState(ru.novosoft.uml.behavior.state_machines.MState m)
|
java.lang.String |
generateStateBody(ru.novosoft.uml.behavior.state_machines.MState m)
|
java.lang.String |
generateTaggedValue(ru.novosoft.uml.foundation.extension_mechanisms.MTaggedValue tv)
|
java.lang.String |
generateTaggedValues(ru.novosoft.uml.foundation.core.MModelElement e)
|
java.lang.String |
generateTransition(ru.novosoft.uml.behavior.state_machines.MTransition m)
|
java.lang.String |
generateVisibility(ru.novosoft.uml.foundation.core.MFeature f)
|
java.lang.String |
generateVisibility(ru.novosoft.uml.foundation.data_types.MVisibilityKind vis)
|
static GeneratorJava |
getInstance()
|
java.lang.String |
getModuleAuthor()
|
java.lang.String |
getModuleDescription()
Textual description of the module. |
java.lang.String |
getModuleKey()
|
java.lang.String |
getModuleName()
Display name of the module. |
java.lang.String |
getModuleVersion()
|
java.lang.String |
getPackageName(java.lang.Object namespace)
Gets the Java package name for a given namespace, ignoring the root namespace (which is the model). |
boolean |
inContext(java.lang.Object[] o)
A function which allows a plug-in to decide if it is available under a specific context. |
boolean |
isLfBeforeCurly()
Returns the _lfBeforeCurly. |
boolean |
isModuleEnabled()
|
boolean |
isVerboseDocs()
Returns the _verboseDocs. |
void |
setLfBeforeCurly(boolean _lfBeforeCurly)
Sets the _lfBeforeCurly. |
void |
setVerboseDocs(boolean _verboseDocs)
Sets the _verboseDocs. |
protected static void |
update(ru.novosoft.uml.foundation.core.MClassifier mClassifier,
java.io.File file)
Update a source code file. |
Methods inherited from class org.argouml.uml.generator.Generator |
generate, generateClassifierRef, generateExpression, generateExpression, generateName, generateStereotype, generateUninterpreted, getCodePath, getGenerator, getModulePopUpActions, getNotation, initializeModule, isTestModus, setModuleEnabled, setTestModus, shutdownModule |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected boolean _verboseDocs
protected boolean _lfBeforeCurly
public static final java.lang.String ANY_RANGE
Constructor Detail |
protected GeneratorJava()
Method Detail |
public static GeneratorJava getInstance()
public static java.lang.String Generate(java.lang.Object o)
public java.lang.String GenerateFile(java.lang.Object me, java.lang.String path)
GenerateFile
in interface FileGenerator
public java.lang.String generateHeader(ru.novosoft.uml.foundation.core.MClassifier cls, java.lang.String pathname, java.lang.String packagePath)
public java.lang.String generateImports(ru.novosoft.uml.foundation.core.MClassifier cls, java.lang.String packagePath)
public java.lang.String generateImportType(ru.novosoft.uml.foundation.core.MClassifier type, java.lang.String exclude)
public java.lang.String generateExtensionPoint(ru.novosoft.uml.behavior.use_cases.MExtensionPoint ep)
Generate code for an extension point.
Provided to comply with the interface, but returns null since no code will be generated. This should prevent a source tab being shown.
generateExtensionPoint
in interface NotationProvider
generateExtensionPoint
in class Generator
ep
- The extension point to generate for
public java.lang.String generateAssociationRole(ru.novosoft.uml.behavior.collaborations.MAssociationRole m)
generateAssociationRole
in interface NotationProvider
public java.lang.String generateOperation(ru.novosoft.uml.foundation.core.MOperation op, boolean documented)
generateOperation
in interface NotationProvider
generateOperation
in class Generator
public java.lang.String generateAttribute(ru.novosoft.uml.foundation.core.MAttribute attr, boolean documented)
generateAttribute
in interface NotationProvider
generateAttribute
in class Generator
public java.lang.String generateCoreAttribute(ru.novosoft.uml.foundation.core.MAttribute attr)
public java.lang.String generateParameter(ru.novosoft.uml.foundation.core.MParameter param)
generateParameter
in interface NotationProvider
generateParameter
in class Generator
public java.lang.String generatePackage(ru.novosoft.uml.model_management.MPackage p)
generatePackage
in interface NotationProvider
generatePackage
in class Generator
protected java.lang.StringBuffer generateClassifierEnd(ru.novosoft.uml.foundation.core.MClassifier cls)
public java.lang.String generateClassifier(ru.novosoft.uml.foundation.core.MClassifier cls)
generateClassifier
in interface NotationProvider
generateClassifier
in class Generator
NotationProvider.generateClassifier(MClassifier)
protected java.lang.StringBuffer generateClassifierBody(ru.novosoft.uml.foundation.core.MClassifier cls)
cls
-
public java.lang.String generateMethodBody(ru.novosoft.uml.foundation.core.MOperation op)
public java.lang.String generateDefaultReturnStatement(ru.novosoft.uml.foundation.core.MClassifier cls)
public java.lang.String generateTaggedValues(ru.novosoft.uml.foundation.core.MModelElement e)
public java.lang.String generateTaggedValue(ru.novosoft.uml.foundation.extension_mechanisms.MTaggedValue tv)
generateTaggedValue
in interface NotationProvider
generateTaggedValue
in class Generator
public java.lang.String generateConstraintEnrichedDocComment(ru.novosoft.uml.foundation.core.MModelElement me, ru.novosoft.uml.foundation.core.MAssociationEnd ae)
me
- the model element for which the documentation comment is neededae
- the association end which is represented by the model element
public static java.lang.String generateConstraintEnrichedDocComment(ru.novosoft.uml.foundation.core.MModelElement me, boolean documented, java.lang.String indent)
me
- the model element for which the documentation comment is neededdocumented
- if existing tagged values should be generated
in addition to javadocindent
- indent String (usually blanks) for indentation of
generated comments
public java.lang.String generateConstraints(ru.novosoft.uml.foundation.core.MModelElement me)
public java.lang.String generateConstraint(ru.novosoft.uml.foundation.core.MConstraint c)
public java.lang.String generateAssociationFrom(ru.novosoft.uml.foundation.core.MAssociation a, ru.novosoft.uml.foundation.core.MAssociationEnd ae)
public java.lang.String generateAssociation(ru.novosoft.uml.foundation.core.MAssociation a)
generateAssociation
in interface NotationProvider
generateAssociation
in class Generator
public java.lang.String generateAssociationEnd(ru.novosoft.uml.foundation.core.MAssociationEnd ae)
generateAssociationEnd
in interface NotationProvider
generateAssociationEnd
in class Generator
public java.lang.String generateCoreAssociationEnd(ru.novosoft.uml.foundation.core.MAssociationEnd ae)
public java.lang.String generateGeneralization(java.util.Collection generalizations)
public java.lang.String generateSpecification(ru.novosoft.uml.foundation.core.MClass cls)
public java.lang.String generateClassList(java.util.Collection classifiers)
public java.lang.String generateVisibility(ru.novosoft.uml.foundation.data_types.MVisibilityKind vis)
public java.lang.String generateVisibility(ru.novosoft.uml.foundation.core.MFeature f)
public java.lang.String generateScope(ru.novosoft.uml.foundation.core.MFeature f)
public java.lang.String generateAbstractness(ru.novosoft.uml.foundation.core.MOperation op)
public java.lang.String generateChangeability(ru.novosoft.uml.foundation.core.MOperation op)
public java.lang.String generateChangability(ru.novosoft.uml.foundation.core.MStructuralFeature sf)
public java.lang.String generateConcurrency(ru.novosoft.uml.foundation.core.MOperation op)
op
- The operation
public java.lang.String generateMultiplicity(ru.novosoft.uml.foundation.data_types.MMultiplicity m)
generateMultiplicity
in interface NotationProvider
generateMultiplicity
in class Generator
public java.lang.String generateMultiplicityRange(ru.novosoft.uml.foundation.data_types.MMultiplicityRange mr)
public java.lang.String generateState(ru.novosoft.uml.behavior.state_machines.MState m)
generateState
in interface NotationProvider
generateState
in class Generator
public java.lang.String generateStateBody(ru.novosoft.uml.behavior.state_machines.MState m)
generateStateBody
in interface NotationProvider
public java.lang.String generateTransition(ru.novosoft.uml.behavior.state_machines.MTransition m)
generateTransition
in interface NotationProvider
generateTransition
in class Generator
public java.lang.String generateAction(java.lang.Object m)
generateAction
in interface NotationProvider
generateAction
in class Generator
public java.lang.String generateGuard(ru.novosoft.uml.behavior.state_machines.MGuard m)
generateGuard
in interface NotationProvider
generateGuard
in class Generator
public java.lang.String generateMessage(ru.novosoft.uml.behavior.collaborations.MMessage m)
generateMessage
in interface NotationProvider
generateMessage
in class Generator
public java.lang.String generateAscEndName(ru.novosoft.uml.foundation.core.MAssociationEnd ae)
public java.lang.String getPackageName(java.lang.Object namespace)
namespace
- the namespace
protected static void update(ru.novosoft.uml.foundation.core.MClassifier mClassifier, java.io.File file) throws java.lang.Exception
mClassifier
- The classifier to update from.file
- The file to update.
java.lang.Exception
public boolean canParse()
NotationProvider
canParse
in interface NotationProvider
public boolean canParse(java.lang.Object o)
NotationProvider
canParse
in interface NotationProvider
public java.lang.String getModuleName()
ArgoModule
getModuleName
in interface ArgoModule
public java.lang.String getModuleDescription()
ArgoModule
getModuleDescription
in interface ArgoModule
public java.lang.String getModuleAuthor()
getModuleAuthor
in interface ArgoModule
public java.lang.String getModuleVersion()
getModuleVersion
in interface ArgoModule
public java.lang.String getModuleKey()
getModuleKey
in interface ArgoModule
public boolean isLfBeforeCurly()
public boolean isVerboseDocs()
public void setLfBeforeCurly(boolean _lfBeforeCurly)
_lfBeforeCurly
- The _lfBeforeCurly to setpublic void setVerboseDocs(boolean _verboseDocs)
_verboseDocs
- The _verboseDocs to setpublic boolean inContext(java.lang.Object[] o)
Pluggable
inContext
in interface Pluggable
inContext
in class Generator
Pluggable.inContext(java.lang.Object[])
public boolean isModuleEnabled()
isModuleEnabled
in interface ArgoModule
isModuleEnabled
in class Generator
ArgoModule.isModuleEnabled()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2003 (20040125) | ArgoUML Project Home | ArgoUML Cookbook |