public class TorqueGenVelocity extends Object
Constructor and Description |
---|
TorqueGenVelocity(VelocityOutlet outlet,
ControllerState controllerState)
Constructs a generator interface within the given controllerState.
|
Modifier and Type | Method and Description |
---|---|
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.
|
Object |
getModel()
Returns the current model object.
|
SourceElement |
getParent()
Returns the parent of the current source element.
|
SourceElement |
getSourceElement()
Returns the current source element, if it is a SourceElement.
|
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.
|
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.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 Object getModel()
getControllerState().getModel()
public SourceElement getSourceElement() throws SourceException
(SourceElement)getControllerState().getModel()
SourceException
- if the model is no SourceElementpublic List<SourceElement> getChildren() throws SourceException
getSourceElement().getChildren()
SourceException
- if the model is no SourceElementpublic List<SourceElement> getChildren(String name) throws SourceException
getSourceElement().getChildren(name)
name
- the name of the children elements to select.SourceException
- if the model is no SourceElementpublic SourceElement getChild(String name) throws SourceException
getSourceElement().getChild(name)
name
- the name of the child element to select.SourceException
- if the model is no SourceElementpublic SourceElement getParent() throws SourceException
getSourceElement().getParent()
SourceException
- if the model is no SourceElementpublic 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.Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.