Interface Outlet
-
- All Known Subinterfaces:
TemplateOutlet
- All Known Implementing Classes:
CamelbackOutlet
,ConstantNameOutlet
,CopyOutlet
,DebuggingOutletWrapper
,GroovyOutlet
,GroovyScriptOutlet
,GroovyTemplateOutlet
,JavadocOutlet
,JavaFilenameOutlet
,ModifySourcenameOutlet
,NewlineOutlet
,OptionOutlet
,OutletImpl
,OutletWithoutMergepoints
,PackageToPathOutlet
,StringInputOutlet
,TemplateOutletImpl
,VelocityOutlet
,XmlOutlet
public interface Outlet
Generates String output from the AST.
-
-
Method Summary
Modifier and Type Method Description void
addMergepointMapping(MergepointMapping mergepointMapping)
Adds an mergepoint mapping to the outlet.void
afterExecute(ControllerState controllerState)
Adjusts the state of the Controller after generation.void
beforeExecute(ControllerState controllerState)
Adjusts the state of the Controller before generation.OutletResult
execute(ControllerState controllerState)
Generates the output for this template into the Generated object.String
getInputClass()
Returns the fully qualified name of the input root class.String
getInputElementName()
Returns the name of the input root element.MergepointMapping
getMergepointMapping(String name)
Returns the mergepoint mapping for the given mergepoint name.Map<String,MergepointMapping>
getMergepointMappings()
Returns the map of all mergepoint mappings, keyed by their name.QualifiedName
getName()
Returns the name of the outlet.void
setInputClass(String inputClass)
Sets the fully qualified name of the input model root class.void
setInputElementName(String inputName)
Sets the name of the input root element.MergepointMapping
setMergepointMapping(MergepointMapping mergepointMapping)
Sets an mergepoint mapping in the outlet.
-
-
-
Method Detail
-
getName
QualifiedName getName()
Returns the name of the outlet. The namespace part of the name defines the default context of the outlet.- Returns:
- the name of the outlet, not null.
-
addMergepointMapping
void addMergepointMapping(MergepointMapping mergepointMapping) throws ConfigurationException
Adds an mergepoint mapping to the outlet. No mergepoint mappings must exist with the given name.- Parameters:
mergepointMapping
- the mergepointMapping to add, not null.- Throws:
NullPointerException
- if mergepointMapping is null.ConfigurationException
- if an mergepointMapping for the given name already exists.
-
setMergepointMapping
MergepointMapping setMergepointMapping(MergepointMapping mergepointMapping)
Sets an mergepoint mapping in the outlet. If a mergepoint mapping with the given name already exists, it is replaced.- Parameters:
mergepointMapping
- the mergepointMapping to add, not null.- Returns:
- the replaced mergepoint mapping, not null.
- Throws:
NullPointerException
- if mergepointMapping is null.
-
getMergepointMapping
MergepointMapping getMergepointMapping(String name)
Returns the mergepoint mapping for the given mergepoint name.- Parameters:
name
- the name of the mergepoint mapping.- Returns:
- the mergepoint mapping for the given name, or null if no mergepoint mapping exists for this name.
-
getMergepointMappings
Map<String,MergepointMapping> getMergepointMappings()
Returns the map of all mergepoint mappings, keyed by their name.- Returns:
- the map of mergepoint mappings, not null.
-
getInputElementName
String getInputElementName()
Returns the name of the input root element. If not null, the outlet checks if the name of the input root element corresponds to the set element name and throws an exception if the names do not match.- Returns:
- inputName the name of the root element of the source, or if any input name is accepted.
-
setInputElementName
void setInputElementName(String inputName)
Sets the name of the input root element. If set, the outlet checks if the name of the input root element corresponds to the set element name and throws an exception if the names do not match.- Parameters:
inputName
- the name of the root element of the source, or null to accept any input name.
-
getInputClass
String getInputClass()
Returns the fully qualified name of the input root class. If not null, the outlet checks if the class name of the input root corresponds to the set class name and throws an exception if the names do not match.- Returns:
- inputName the name of the root element of the source, or if any input name is accepted.
-
setInputClass
void setInputClass(String inputClass)
Sets the fully qualified name of the input model root class. If set, the outlet checks if the class name of the input model root corresponds to the set class name and throws an exception if the names do not match.- Parameters:
inputClass
- the name of the root element of the source, or null to accept any input name.
-
beforeExecute
void beforeExecute(ControllerState controllerState) throws GeneratorException
Adjusts the state of the Controller before generation.- Parameters:
controllerState
- the current controller state, not null.- Throws:
GeneratorException
- if adjusting the controller state fails.
-
afterExecute
void afterExecute(ControllerState controllerState) throws GeneratorException
Adjusts the state of the Controller after generation.- Parameters:
controllerState
- the current controller state, not null.- Throws:
GeneratorException
- if adjusting the controller state fails.
-
execute
OutletResult execute(ControllerState controllerState) throws GeneratorException
Generates the output for this template into the Generated object.- Parameters:
controllerState
- the current controller state, not null.- Returns:
- the output of the Outlet.
- Throws:
GeneratorException
- if generation fails.
-
-