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

com.gentleware.poseidon.generator

Class CodeTemplate

com.gentleware.poseidon.generator.CodeTemplate

public class CodeTemplate


A container for velocity code templates ("working templates").
Authors:
Thorsten Sturm <thorsten.sturm@gentleware.com>


 Attribute Summary
protected static int  MAX_UNDERSCORE_INDENT_LEVEL
 
protected static char  UNDERSCORE_INDENT_CHAR
 
private String  _name
Name of the CodeTemplate, currently used in Enhanced Editor sublanguage comboBox for showing code names  
private Object  _predicate
The predicate object used to find out if this is the template we are looking for. 
private String  _templatePath
 
arrow_up
 

 Association Summary
private VelocityContext  _context
 
private Template  _template
 
arrow_up
 

 Constructor Summary
public   CodeTemplate(String templatePath, String name)
Creates a new template. 
arrow_up
 

 Method Summary
public void   addContext(String str, Object o)
Adds an entry to the current context. 
protected void   addIndentationSpaces()

Adds indendation-underscores to the code-templates so that they can be indented e. g. 

public void   generate(Writer writer)
Updates the template and generates to the given writer. 
public VelocityContext   getContext()
Getter for the context. 
public String   getName()
getter for the name  
public Object   getPredicate()
Returns the predicate associated with this template. 
public Template   getTemplate()
Getter for the current template. 
public String   getTemplatePath()
Getter for the template path,  
public void   initContext()
Creates a blank velocity context. 
public void   setContext(VelocityContext context)
Setter for the context. 
public void   setName(String name)
setter for the name  
public void   setPredicate(Object predicate)
Sets the predicate this template is associated with. 
public void   setTemplate(Template template)
Setter for the current template. 
public void   setTemplatePath(String path)
Setter for the template path. 
public String   toString()
 
public void   updateTemplate()
Reloads the template. 
arrow_up
 

Tagged Values
static false
 

 Attribute Detail

MAX_UNDERSCORE_INDENT_LEVEL

protected static int MAX_UNDERSCORE_INDENT_LEVEL

arrow_up


UNDERSCORE_INDENT_CHAR

protected static char UNDERSCORE_INDENT_CHAR

arrow_up


_name

private String _name

Name of the CodeTemplate, currently used in Enhanced Editor sublanguage comboBox for showing code names  
arrow_up


_predicate

private Object _predicate

The predicate object used to find out if this is the template we are looking for. The predicate test is implemented in classes implementing CodeTemplateManager.  
arrow_up


_templatePath

private String _templatePath

arrow_up
 Association Detail

_context

private VelocityContext _context

arrow_up


_template

private Template _template

arrow_up
 Constructor Detail

CodeTemplate

public CodeTemplate CodeTemplate(String templatePath, String name)


Creates a new template.  
Parameters:
templatePath - the path
name - name of the template
Returns:
arrow_up
 Method Detail

addContext

public void addContext(String str, Object o)


Adds an entry to the current context.  
Parameters:
str - The key (variable name in velocity).
o - The value (the Java object).
arrow_up


addIndentationSpaces

protected void addIndentationSpaces()


Adds indendation-underscores to the code-templates so that they can be indented e. g. by using $___ at the start of the line. This prevents the indendation to appear in the source-code.

 
arrow_up


generate

public void generate(Writer writer)


Updates the template and generates to the given writer.  
Parameters:
writer - The destination of the generated String.
arrow_up


getContext

public VelocityContext getContext()


Getter for the context.  
Returns:
The current VelocityContext or null.
arrow_up


getName

public String getName()


getter for the name  
Returns:
arrow_up


getPredicate

public Object getPredicate()


Returns the predicate associated with this template.  
Returns:
The associated predicate object.
arrow_up


getTemplate

public Template getTemplate()


Getter for the current template.  
Returns:
arrow_up


getTemplatePath

public String getTemplatePath()


Getter for the template path,  
Returns:
arrow_up


initContext

public void initContext()


Creates a blank velocity context.  
arrow_up


setContext

public void setContext(VelocityContext context)


Setter for the context.  
Parameters:
context - The new context.
arrow_up


setName

public void setName(String name)


setter for the name  
Parameters:
name -
arrow_up


setPredicate

public void setPredicate(Object predicate)


Sets the predicate this template is associated with.  
Parameters:
predicate - The predicate object to associate this template with.
arrow_up


setTemplate

public void setTemplate(Template template)


Setter for the current template.  
Parameters:
template -
arrow_up


setTemplatePath

public void setTemplatePath(String path)


Setter for the template path.  
Parameters:
path -
arrow_up


toString

public String toString()

Returns:
arrow_up


updateTemplate

public void updateTemplate()


Reloads the template. useful when it has been modified.  
arrow_up
Created  2004 - 10 - 21

    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 2003-2004 Gentleware AG, Schanzenstr. 70, 20357 Hamburg, Germany. All Rights Reserved.

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