org.argouml.uml.generator
Class Generator2

java.lang.Object
  extended byorg.argouml.uml.generator.Generator2
All Implemented Interfaces:
ArgoModule, Pluggable, PluggableNotation
Direct Known Subclasses:
GeneratorJava

Deprecated. This class is deprecated in favour of GeneratorManager and the CodeGenerator interface.

Explanation by Daniele Tamino:

Why Generator2 is deprecated: Because it was replaced by CodeGenerator and GeneratorManager. The Generator2 class kept a list of Generator2 objects, populated during construction, but that list was not changeable afterward, and this was incompatible with the new module loader (see issue 3580 ), so here comes GeneratorManager. Moreover, there was no reasonable way to display the generated source correctly in the source pane using Generator2 or FileGenerator, and for this the CodeGenerator interface was created (issue 3546 ).

In ArgoUML V0.21.2 Generator2 was still used for another purpose, i.e. it implemented some common methods of the NotationProvider2 interface too, which went away when the new notation architecture got more and more completed (issue 1207 ).

public abstract class Generator2
extends Object
implements PluggableNotation

This class is the abstract super class that defines a code generation framework. It is basically a depth-first traversal of the UML model that generates strings as it goes. This framework should probably be redesigned to separate the traversal logic from the generation logic. See the Visitor design pattern in "Design Patterns", and the Demeter project.

Since:
0.15.6

Field Summary
static String INDENT
          Deprecated. Two spaces used for indenting code in classes.
 
Fields inherited from interface org.argouml.application.api.Pluggable
PLUGIN_PREFIX, PLUGIN_TITLE, PLUGIN_VENDOR
 
Fields inherited from interface org.argouml.application.api.ArgoModule
MODULEFILENAME, MODULEFILENAME_ALTERNATE
 
Constructor Summary
Generator2(NotationName nn)
          Deprecated. Constructor that sets the name of this notation.
 
Method Summary
 String generate(Object o)
          Deprecated. Generates code for some modelelement.
abstract  String generateAction(Object m)
          Deprecated.  
abstract  String generateActionState(Object actionState)
          Deprecated.  
abstract  String generateAssociation(Object a)
          Deprecated.  
abstract  String generateAssociationEnd(Object ae)
          Deprecated.  
abstract  String generateAttribute(Object attr, boolean documented)
          Deprecated.  
abstract  String generateClassifier(Object cls)
          Deprecated.  
 String generateClassifierRef(Object cls)
          Deprecated.  
abstract  String generateEvent(Object m)
          Deprecated.  
 String generateExpression(Object expr)
          Deprecated.  
abstract  String generateExtensionPoint(Object op)
          Deprecated.  
abstract  String generateGuard(Object m)
          Deprecated.  
abstract  String generateMessage(Object m)
          Deprecated.  
abstract  String generateMultiplicity(Object m)
          Deprecated.  
 String generateName(String n)
          Deprecated.  
abstract  String generateObjectFlowState(Object m)
          Deprecated.  
abstract  String generateOperation(Object op, boolean documented)
          Deprecated.  
abstract  String generatePackage(Object p)
          Deprecated.  
abstract  String generateParameter(Object param)
          Deprecated.  
abstract  String generateState(Object m)
          Deprecated.  
 String generateStereotype(Object st)
          Deprecated.  
abstract  String generateSubmachine(Object m)
          Deprecated.  
abstract  String generateTaggedValue(Object s)
          Deprecated.  
abstract  String generateTransition(Object m)
          Deprecated.  
 String generateUninterpreted(String un)
          Deprecated. Make a string non-null.
abstract  String generateVisibility(Object m)
          Deprecated.  
static String getCodePath(Object me)
          Deprecated. Gets the path of the code base for a model element.
static Generator2 getGenerator(NotationName n)
          Deprecated. Access method that finds the correct generator based on a name.
 Vector getModulePopUpActions(Vector v, Object o)
          Deprecated. Calls all modules to let them add to a popup menu.
 NotationName getNotation()
          Deprecated.  
 boolean inContext(Object[] o)
          Deprecated. A function which allows a plug-in to decide if it is available under a specific context.
 boolean initializeModule()
          Deprecated. Method called when Argo is loading a module.
 boolean isModuleEnabled()
          Deprecated. The default for any Generator is to be enabled.
 void setModuleEnabled(boolean enabled)
          Deprecated. Called to enable or disable a module programmatically.
 boolean shutdownModule()
          Deprecated. Method called when Argo is unloading a module.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.argouml.application.api.ArgoModule
getModuleAuthor, getModuleDescription, getModuleKey, getModuleName, getModuleVersion
 

Field Detail

INDENT

public static final String INDENT
Deprecated. 
Two spaces used for indenting code in classes.

See Also:
Constant Field Values
Constructor Detail

Generator2

public Generator2(NotationName nn)
Deprecated. 
Constructor that sets the name of this notation.

Parameters:
nn - The NotationName object.
Method Detail

getGenerator

public static Generator2 getGenerator(NotationName n)
Deprecated. 
Access method that finds the correct generator based on a name.

Parameters:
n - The name.
Returns:
a generator (or null if not found).

getNotation

public NotationName getNotation()
Deprecated. 
See Also:
NotationProvider2#getNotation()

generate

public String generate(Object o)
Deprecated. 
Generates code for some modelelement. Subclasses should implement this to generate code for different notations.

Parameters:
o - the element to be generated
Returns:
String the generated code

generateActionState

public abstract String generateActionState(Object actionState)
Deprecated. 

generateExtensionPoint

public abstract String generateExtensionPoint(Object op)
Deprecated. 

generateOperation

public abstract String generateOperation(Object op,
                                         boolean documented)
Deprecated. 

generateAttribute

public abstract String generateAttribute(Object attr,
                                         boolean documented)
Deprecated. 

generateParameter

public abstract String generateParameter(Object param)
Deprecated. 

generatePackage

public abstract String generatePackage(Object p)
Deprecated. 

generateClassifier

public abstract String generateClassifier(Object cls)
Deprecated. 

generateTaggedValue

public abstract String generateTaggedValue(Object s)
Deprecated. 

generateAssociation

public abstract String generateAssociation(Object a)
Deprecated. 

generateAssociationEnd

public abstract String generateAssociationEnd(Object ae)
Deprecated. 

generateMultiplicity

public abstract String generateMultiplicity(Object m)
Deprecated. 

generateObjectFlowState

public abstract String generateObjectFlowState(Object m)
Deprecated. 

generateState

public abstract String generateState(Object m)
Deprecated. 

generateSubmachine

public abstract String generateSubmachine(Object m)
Deprecated. 

generateTransition

public abstract String generateTransition(Object m)
Deprecated. 

generateAction

public abstract String generateAction(Object m)
Deprecated. 

generateGuard

public abstract String generateGuard(Object m)
Deprecated. 

generateMessage

public abstract String generateMessage(Object m)
Deprecated. 

generateEvent

public abstract String generateEvent(Object m)
Deprecated. 

generateVisibility

public abstract String generateVisibility(Object m)
Deprecated. 

generateExpression

public String generateExpression(Object expr)
Deprecated. 

generateName

public String generateName(String n)
Deprecated. 

generateUninterpreted

public String generateUninterpreted(String un)
Deprecated. 
Make a string non-null.

What is the purpose of this function? Shouldn't it be private static?

Parameters:
un - The String.
Returns:
a non-null string.

generateClassifierRef

public String generateClassifierRef(Object cls)
Deprecated. 

generateStereotype

public String generateStereotype(Object st)
Deprecated. 

getModulePopUpActions

public Vector getModulePopUpActions(Vector v,
                                    Object o)
Deprecated. 
Description copied from interface: ArgoModule
Calls all modules to let them add to a popup menu.

Specified by:
getModulePopUpActions in interface ArgoModule
Parameters:
v - Vector of actions
o - which the actions are valid for
Returns:
Vector containing pop-up actions
See Also:
ArgoModule.getModulePopUpActions( Vector, Object)

shutdownModule

public boolean shutdownModule()
Deprecated. 
Description copied from interface: ArgoModule
Method called when Argo is unloading a module.

Specified by:
shutdownModule in interface ArgoModule
Returns:
true if the module terminated properly.
See Also:
ArgoModule.shutdownModule()

initializeModule

public boolean initializeModule()
Deprecated. 
Description copied from interface: ArgoModule
Method called when Argo is loading a module.

Specified by:
initializeModule in interface ArgoModule
Returns:
true if the module initialized properly.
See Also:
ArgoModule.initializeModule()

setModuleEnabled

public void setModuleEnabled(boolean enabled)
Deprecated. 
Description copied from interface: ArgoModule
Called to enable or disable a module programmatically.

Specified by:
setModuleEnabled in interface ArgoModule
Parameters:
enabled - true to enable module, false to disable
See Also:
ArgoModule.setModuleEnabled(boolean)

inContext

public boolean inContext(Object[] o)
Deprecated. 
Description copied from interface: Pluggable
A function which allows a plug-in to decide if it is available under a specific context. One example of a plugin with multiple criteria is the PluggableMenu. PluggableMenu requires the first context to be a JMenuItem which wants the PluggableMenu attached to as the context, so that it can determine that it would attach to a menu. The second context is an internal (non-localized) description of the menu such as "File" or "View" so that the plugin can further decide.

Specified by:
inContext in interface Pluggable
Parameters:
o - An identification of the context. The interpretation of criteria is specific to the plug-in type, but must be consistent across that type. The plug-in must want to be exposed to all contexts.
Returns:
True if the plug-in wants to make itself available for this context, otherwise false.
See Also:
Pluggable.inContext(Object[])

getCodePath

public static String getCodePath(Object me)
Deprecated. 
Gets the path of the code base for a model element.

If empty or not existing return null.

Parameters:
me - The model element
Returns:
String representation of "src_path" tagged value.

isModuleEnabled

public boolean isModuleEnabled()
Deprecated. 
The default for any Generator is to be enabled.

Specified by:
isModuleEnabled in interface ArgoModule
Returns:
that this module is enabled.
See Also:
ArgoModule.isModuleEnabled()


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook