|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.torque.generator.template.velocity.TorqueGenVelocity
public class TorqueGenVelocity
This class acts as an interface to the Torque generator from the templates. It lets the user access Torque generator properties from the templates, and allows to execute certain action from within the templates.
Constructor Summary | |
---|---|
TorqueGenVelocity(VelocityOutlet outlet,
ControllerState controllerState)
Constructs a generator interface within the given controllerState. |
Method Summary | |
---|---|
boolean |
booleanOption(String key)
Returns the option with the given key as boolean value. |
SourceElement |
getChild(String name)
Returns the first child of the current source element with the given name. |
List<SourceElement> |
getChildren()
Returns all children of the current source element. |
List<SourceElement> |
getChildren(String name)
Returns the children of the current source element with a certain name. |
ControllerState |
getControllerState()
Returns the current controller state. |
static int |
getCounter()
Returns a counter value which is increased each time this function is accessed. |
SourceElement |
getParent()
Returns the parent of the current source element. |
SourceElement |
getSourceElement()
Returns the current source element. |
File |
getSourceFile()
Returns the currently processed source file. |
Object |
getVariable(String key)
Returns the variable with the given key. |
int |
intOption(String key)
Returns the option with the given key as int value. |
String |
mergepoint(String mergepointName)
Processes the mergepoint with the given name. |
Date |
now()
Returns the current date. |
Object |
option(String key)
Returns the option with the given key. |
static void |
resetCounter()
Resets the counter accessible though getCounter() back to 1. |
void |
setVariable(String key,
Object value)
Sets a variable. |
void |
setVariable(String key,
Object value,
String scope)
Sets a variable. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TorqueGenVelocity(VelocityOutlet outlet, ControllerState controllerState)
outlet
- the outlet in which this generator interface will be used,
not null.controllerState
- the controller context.
NullPointerException
- if outlet or controllerState are null.Method Detail |
---|
public String mergepoint(String mergepointName) throws GeneratorException
mergepointName
- the name of the mergepoint.
GeneratorException
- if the mergepoint could not be processed
completely.public ControllerState getControllerState()
public SourceElement getSourceElement()
getControllerState().getSourceElement()
public List<SourceElement> getChildren()
getSourceElement().getChildren()
public List<SourceElement> getChildren(String name)
getSourceElement().getChildren(name)
name
- the name of the children elements to select.
public SourceElement getChild(String name)
getSourceElement().getChild(name)
name
- the name of the child element to select.
public SourceElement getParent()
getSourceElement().getParent()
public Object option(String key)
key
- the key for the option to retrieve.
public boolean booleanOption(String key)
key
- the key for the option to retrieve.
public int intOption(String key)
key
- the key for the option to retrieve.
public Object getVariable(String key)
key
- the key for the variable to retrieve.
public void setVariable(String key, Object value)
key
- the name of the variable, not nullvalue
- the value of the variable, may be null.
NullPointerException
- if key or scope is null.
IllegalArgumentException
- if the key is no valid QualifiedName.public void setVariable(String key, Object value, String scope)
key
- the name of the variable, not null.value
- the value of the variable, may be null.scope
- the scope of the variable, not null.
NullPointerException
- if key or scope is null.
IllegalArgumentException
- if the key is no valid QualifiedName.public File getSourceFile()
public Date now()
public static int getCounter()
resetCounter
is not called, the returned value is unique
over the generation process.
public static void resetCounter()
getCounter()
back to 1.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |