public abstract class GroovyOutlet extends TemplateOutletImpl
Modifier and Type | Field and Description |
---|---|
static String |
NULL_KEY_BINDING_NAME
The key under which the null attribute of a source element is put
into the binding.
|
static String |
TORQUE_GEN_BINDING_NAME
The name under which the Torque generator interface will be put
into the binding.
|
Constructor and Description |
---|
GroovyOutlet(QualifiedName name,
ConfigurationProvider configurationProvider,
String path,
String encoding)
Constructs a new GroovyOutlet.
|
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
createBinding(ControllerState controllerState) |
OutletResult |
execute(ControllerState controllerState)
Executes the generation process; the result is returned.
|
protected abstract String |
executeGroovy(Map<String,Object> binding,
ControllerState controllerState)
Executes the Groovy script or template and retuns the reult.
|
boolean |
isOptionsInBinding()
Returns whether all options which namespaces are visible to
the name space of this outlet are put into the binding.
|
boolean |
isSourceAttributesInBinding()
Returns whether the attributes of the current source element
are put into the binding.
|
boolean |
isVariablesInBinding()
Returns whether all variables which are visible to this
outlet are put into the binding.
|
void |
setOptionsInBinding(boolean optionsInBinding)
Tells the outlet to put all options which name space is visible to
the namespace of this outlet into the binding.
|
void |
setSourceAttributesInBinding(boolean sourceAttributesInBinding)
Tells the outlet to put the attributes of the current source element
into the binding or not.
|
void |
setVariablesInContext(boolean variablesInBinding)
Tells the outlet to put all variables which are visible to this
outlet into the binding.
|
getContent, getDetokenizedPath, getPath, load, toString
addMergepointMapping, afterExecute, beforeExecute, getInputClass, getInputElementName, getMergepointMapping, getMergepointMappings, getName, getVariable, mergepoint, setInputClass, setInputElementName, setMergepointMapping, setVariable, setVariable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addMergepointMapping, afterExecute, beforeExecute, getInputClass, getInputElementName, getMergepointMapping, getMergepointMappings, getName, setInputClass, setInputElementName, setMergepointMapping
public static final String TORQUE_GEN_BINDING_NAME
public static final String NULL_KEY_BINDING_NAME
public GroovyOutlet(QualifiedName name, ConfigurationProvider configurationProvider, String path, String encoding) throws ConfigurationException
name
- the name of this outlet, not null.configurationProvider
- the provider for reading the templates,
not null.path
- the path to the templates, not null.encoding
- the encoding of the file, or null if the system's
default encoding should be used.NullPointerException
- if name, path or directories are null.ConfigurationException
- if an error occurs while reading the
template.public OutletResult execute(ControllerState controllerState) throws GeneratorException
execute
in interface Outlet
execute
in class OutletImpl
controllerState
- the current controller state.GeneratorException
- if generation fails.Outlet.execute(ControllerState)
protected abstract String executeGroovy(Map<String,Object> binding, ControllerState controllerState) throws GeneratorException
binding
- the binding, not null.controllerState
- the controller state, not null.GeneratorException
- if generation fails.public Map<String,Object> createBinding(ControllerState controllerState)
public void setOptionsInBinding(boolean optionsInBinding)
optionsInBinding
- whether to put the options into the context.public boolean isOptionsInBinding()
public void setVariablesInContext(boolean variablesInBinding)
variablesInBinding
- whether to put the variables into the context.public boolean isVariablesInBinding()
public void setSourceAttributesInBinding(boolean sourceAttributesInBinding)
sourceAttributesInBinding
- whether to put the source attributes
into the binding.public boolean isSourceAttributesInBinding()
Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.