Poseidon for UMLTM
  UMLdoc
 PREV      NEXT       FRAMES    NO FRAMES      

com.gentleware.poseidon.generator

Interface Generator


public interface Generator
has stereotype << interface >>

The Generator handles the preparation of code relevant information and the generation of the code to a given target. For preparation, the Generator uses a corresponding ElementPreparator.
See also:
GeneratorController
ElementPreparator


 Method Summary
public void   addCodeTemplate(Class elementClass , CodeTemplate template )
Adds a CodeTemplate instance to the set of known CodeTemplates. 
public void   addCodeTemplate(Class elementClass , CodeTemplate template , boolean treatAsUnencrypted )
Adds a CodeTemplate instance to the set of known CodeTemplates. 
public void   addExternalLibraries(String origin , List libraries )
Adds a list of paths to externally known macro libraries and maps them to origin of knowledge. 
public void   addExternalLibraries(String origin , List libraries , boolean treatAsUnencrypted )
Adds a list of paths to externally known macro libraries and maps them to origin of knowledge. 
public boolean   addMacroLibrary(String path )
Adds the path to a new macro library to the list of needed libraries. 
public boolean   addMacroLibrary(String path , boolean treatAsUnencrypted )
Adds the path to a new macro library to the list of needed libraries. 
public void   generatePost(String path )
Contains actions, that should be done after the generation itself. 
public void   generatePre(String path )
Contains actions, that should be done prior to the generation itself. 
public String   generateTarget(Object element , String targetLocation )
Generates the code for the given element at the desired target location. 
public List   generateTargets(Object element , String targetLocation , Object predicate )
Generates the code for the given element at the desired target location. 
public CodeTemplate   getCodeTemplate(Object element )
Returns the CodeTemplate instance to be used for generating the code file. 
public CodeTemplate   getCodeTemplate(Class elementClass )
Returns the CodeTemplate instance to be used for generating the code file. 
public String   getFilenameForElement(Object element , String targetLocation )
The filename where the element's contents end up, or null if the element has no own file. 
public Map   getFilenamesForElement(Object element , String targetLocation )
The list of filenames where the element's contents end up, or null if the element has no own file. 
public List   getMacroLibraries()
Returns the velocity macro libraries that need to be added to the macro pool in order to make the code generation work. 
public String   getPlainFilenameForElement(Object element , String targetLocation )
Returns the plain filename for the given element. 
public ElementPreparator   getPreparator()
Returns the corresponding ElementPreparator instance. 
public CodeTemplateManager   getTemplateManager()
Returns the CodeTemplateManager currently registered for this generator. 
public void   init()
Intializes the Generator 
public void   prepareFromRootElement( CheckNode root )
Starts preparing the element information, starting with the given root element and moving recursively down the tree. 
public void   removeExternalLibraries(String origin )
Removes the list of paths to macro libraries known from the given origin. 
public boolean   removeMacroLibrary(String path )
Removes the macro library at the given path from the list of needed libraries. 
public void   setExternalLibraryStrategy( ExternalEntryStrategy strategy )
Set the strategy used to decide how to handle external libraries. 
public void   setTemplateManager( CodeTemplateManager templateManager )
Sets the CodeTemplateManager to be used by this generator to a new instance. 
public void   setTemplateStrategy( TemplateStrategy strategy )
Set the strategy used to handle templates for special element classes. 
public boolean   usesPredicates()
Tests, if the generator controller should use the predicate-based generation framework. 
arrow_up
 

 

 Method Detail

addCodeTemplate

public void addCodeTemplate(Class elementClass , CodeTemplate template )

Adds a CodeTemplate instance to the set of known CodeTemplates. Each of the CodeTemplate instances is mapped to a class of elements. For each class elements only one CodeTemplate instance can be defined, while the CodeTemplate instances can be mapped to more than one element class. The template will be treated as encrypted.
Parameters:
elementClass - Class of elements this CodeTemplate instance is used for.
template - The CodeTemplate instance to be added.
 
arrow_up
 
 

addCodeTemplate

public void addCodeTemplate(Class elementClass , CodeTemplate template , boolean treatAsUnencrypted )

Adds a CodeTemplate instance to the set of known CodeTemplates. Each of the CodeTemplate instances is mapped to a class of elements. For each class elements only one CodeTemplate instance can be defined, while the CodeTemplate instances can be mapped to more than one element class.
Parameters:
elementClass - Class of elements this CodeTemplate instance is used for.
template - The CodeTemplate instance to be added.
treatAsUnencrypted - True, if the template should be treated as unencrypted.
 
arrow_up
 
 

addExternalLibraries

public void addExternalLibraries(String origin , List libraries )

Adds a list of paths to externally known macro libraries and maps them to origin of knowledge. All contained libraries will be treated as unencrypted.
Parameters:
origin - Place where the knowledge about the libraries comes from (e.g. a plugin).
libraries - List of paths to the externally known macro libraries.
 
arrow_up
 
 

addExternalLibraries

public void addExternalLibraries(String origin , List libraries , boolean treatAsUnencrypted )

Adds a list of paths to externally known macro libraries and maps them to origin of knowledge.
Parameters:
origin - Place where the knowledge about the libraries comes from (e.g. a plugin).
libraries - List of paths to the externally known macro libraries.
treatAsUnencrypted - True, if the libraries should be treated as unencrypted.
 
arrow_up
 
 

addMacroLibrary

public boolean addMacroLibrary(String path )

Adds the path to a new macro library to the list of needed libraries. The library will be treated as unencrypted.
Parameters:
path - Path to the new macro library.
Returns:
True, if adding was successful, otherwise false.
 
arrow_up
 
 

addMacroLibrary

public boolean addMacroLibrary(String path , boolean treatAsUnencrypted )

Adds the path to a new macro library to the list of needed libraries.
Parameters:
path - Path to the new macro library.
treatAsUnencrypted - True, if the template should be treated as unencrypted.
Returns:
True, if adding was successful, otherwise false.
 
arrow_up
 
 

generatePost

public void generatePost(String path )

Contains actions, that should be done after the generation itself.
Parameters:
path - Path to the target of the code generation.
 
arrow_up
 
 

generatePre

public void generatePre(String path )

Contains actions, that should be done prior to the generation itself.
Parameters:
path - Path to the target of the code generation.
 
arrow_up
 
 

generateTarget

public String generateTarget(Object element , String targetLocation )

Generates the code for the given element at the desired target location. The target location usually describes the path to a file, but can also be something different (e.g. a table in a relational database). If the targetLocation is set to null, the generation assumes a display as target.
Parameters:
element - The element code should generated for.
targetLocation - A String describing the location of the target or null.
Returns:
The path to the target location or the generated code when no target is specified.
 
arrow_up
 
 

generateTargets

public List generateTargets(Object element , String targetLocation , Object predicate )

Generates the code for the given element at the desired target location. The target location usually describes the path to a file, but can also be something different (e.g. a table in a relational database). If the targetLocation is set to null, the generation assumes a display as target. Multiple files can be created for reflecting different parts of the code.
Parameters:
element - The element code should generated for.
targetLocation - A String describing the location of the target or null.
predicate - The predicate used to determine the right set of code template to use.
Returns:
The paths to the target location or the generated code when no target is specified.
 
arrow_up
 
 

getCodeTemplate

public CodeTemplate getCodeTemplate(Object element )

Returns the CodeTemplate instance to be used for generating the code file.
Parameters:
element - Element the CodeTemplate instance should be retrieved for.
Returns:
The CodeTemplate instance to be used for the given element.
 
arrow_up
 
 

getCodeTemplate

public CodeTemplate getCodeTemplate(Class elementClass )

Returns the CodeTemplate instance to be used for generating the code file.  
arrow_up
 
 

getFilenameForElement

public String getFilenameForElement(Object element , String targetLocation )

The filename where the element's contents end up, or null if the element has no own file.  
arrow_up
 
 

getFilenamesForElement

public Map getFilenamesForElement(Object element , String targetLocation )

The list of filenames where the element's contents end up, or null if the element has no own file.
Parameters:
element - The element to calculate the filenames for.
targetLocation - The directory where the generated files should be created in.
Returns:
A map holding the calculated filename for each registered suffix associated to the suffix.
 
arrow_up
 
 

getMacroLibraries

public List getMacroLibraries()

Returns the velocity macro libraries that need to be added to the macro pool in order to make the code generation work.
Returns:
List of paths to the needed macro libraries. Each entry is a String.
 
arrow_up
 
 

getPlainFilenameForElement

public String getPlainFilenameForElement(Object element , String targetLocation )

Returns the plain filename for the given element. No extensions are used to calculate the name.
Parameters:
element - The element to calculate the name for.
targetLocation - The directory where the generated files should be created in.
Returns:
A string representing the calculated plain name.
 
arrow_up
 
 

getPreparator

public ElementPreparator getPreparator()

Returns the corresponding ElementPreparator instance.
Returns:
The corresponding instance of ElementPreparator.
 
arrow_up
 
 

getTemplateManager

public CodeTemplateManager getTemplateManager()

Returns the CodeTemplateManager currently registered for this generator.
Returns:
The currently registered CodeTemplateManager.
 
arrow_up
 
 

init

public void init()

Intializes the Generator 
arrow_up
 
 

prepareFromRootElement

public void prepareFromRootElement( CheckNode root )

Starts preparing the element information, starting with the given root element and moving recursively down the tree.
Parameters:
root - Root node of the element tree used for retrieving the element information.
 
arrow_up
 
 

removeExternalLibraries

public void removeExternalLibraries(String origin )

Removes the list of paths to macro libraries known from the given origin.
Parameters:
origin - Place where the knowledge about the libraries comes from (e.g. a plugin).
 
arrow_up
 
 

removeMacroLibrary

public boolean removeMacroLibrary(String path )

Removes the macro library at the given path from the list of needed libraries.
Parameters:
path - Path to the macro library.
Returns:
True, if removing was successful, otherwise false.
 
arrow_up
 
 

setExternalLibraryStrategy

public void setExternalLibraryStrategy( ExternalEntryStrategy strategy )

Set the strategy used to decide how to handle external libraries.
Parameters:
strategy - The strategy containing the decision implementation.
 
arrow_up
 
 

setTemplateManager

public void setTemplateManager( CodeTemplateManager templateManager )

Sets the CodeTemplateManager to be used by this generator to a new instance.
Parameters:
templateManager - The new instance of CodeTemplateManager.
 
arrow_up
 
 

setTemplateStrategy

public void setTemplateStrategy( TemplateStrategy strategy )

Set the strategy used to handle templates for special element classes.
Parameters:
strategy - The strategy containing the handling implementation.
 
arrow_up
 
 

usesPredicates

public boolean usesPredicates()

Tests, if the generator controller should use the predicate-based generation framework.
Returns:
True, if the predicate-based generation framework should be used, otherwise false.
 
arrow_up
 

Created  2003 - 3 - 4

    Poseidon for UMLTM
  UMLdoc
 PREV  CLASSIFIER    NEXT  CLASSIFIER     FRAMES    NO FRAMES      
SUMMARY:   INNER | ATTR | ASSOC | CONSTR | METHOD     DETAIL:   INNER | ATTR | ASSOC | CONSTR | METHOD     DIAGRAMS:   COLLAB | SEQ | STATE | ACTIV

Generated with Poseidon for UMLTM.
Poseidon is a registered trademark of Gentleware AG in Germany, USA and other countries. Copyright 2001 Gentleware AG, Vogt-Kölln-Str.30, 22527 Hamburg, Germany. All Rights Reserved.

UML is a trademark or registered trademark of Object Management Group, Inc. in the U.S. and other countries.