public abstract class TemplateEngine<C> extends Object
Modifier and Type | Field and Description |
---|---|
protected TemplateContext<C> |
context |
protected TemplateContext<C> |
lastContext |
protected ToolAdapterOperatorDescriptor |
operatorDescriptor |
Modifier | Constructor and Description |
---|---|
protected |
TemplateEngine(ToolAdapterOperatorDescriptor descriptor) |
Modifier and Type | Method and Description |
---|---|
static TemplateEngine |
createInstance(ToolAdapterOperatorDescriptor descriptor,
TemplateType templateType)
Creates an instance of a template engine, of the given type, for the given descriptor.
|
static TemplateEngine |
createInstance(ToolAdapterOperatorDescriptor descriptor,
TemplateType templateType,
boolean stateful)
Creates an instance of a template engine.
|
abstract String |
execute(Template template,
Map<String,Object> parameters)
Processes the given template.
|
TemplateContext<C> |
getContext()
Returns the last execution context.
|
List<String> |
getLines(Template template,
Map<String,Object> parameters)
Returns the contents of the processed template as a list of strings (lines).
|
Path |
getTemplateBasePath()
Returns the absolute path of the template file.
|
abstract TemplateType |
getType()
Returns the type of the template.
|
abstract void |
parse(Template template)
Parses the given template without processing it.
|
protected ToolAdapterOperatorDescriptor operatorDescriptor
protected TemplateContext<C> context
protected TemplateContext<C> lastContext
protected TemplateEngine(ToolAdapterOperatorDescriptor descriptor)
public abstract void parse(Template template) throws TemplateException
template
- The template to parseTemplateException
public abstract String execute(Template template, Map<String,Object> parameters) throws TemplateException
template
- The template to be processedparameters
- Parameters to be passed to the template.TemplateException
public abstract TemplateType getType()
public TemplateContext<C> getContext()
public static TemplateEngine createInstance(ToolAdapterOperatorDescriptor descriptor, TemplateType templateType)
descriptor
- The descriptor for which to create the enginetemplateType
- The template typepublic static TemplateEngine createInstance(ToolAdapterOperatorDescriptor descriptor, TemplateType templateType, boolean stateful)
descriptor
- The operator descriptortemplateType
- The template typestateful
- If true
, the scripting engine will be singleton-like.public List<String> getLines(Template template, Map<String,Object> parameters) throws TemplateException
template
- The template to be processedparameters
- Parameters to be passed to the template engineTemplateException
public Path getTemplateBasePath()
Copyright © 2014–2017 European Space Agency (ESA). All rights reserved.