Package org.esa.snap.core.gpf.descriptor
Class TemplateParameterDescriptor
- java.lang.Object
-
- org.esa.snap.core.gpf.descriptor.DefaultParameterDescriptor
-
- org.esa.snap.core.gpf.descriptor.ToolParameterDescriptor
-
- org.esa.snap.core.gpf.descriptor.TemplateParameterDescriptor
-
- All Implemented Interfaces:
DataElementDescriptor
,ElementDescriptor
,ParameterDescriptor
public class TemplateParameterDescriptor extends ToolParameterDescriptor
Specialization class for parameters based on a template, with their own parameters.
-
-
Field Summary
-
Fields inherited from class org.esa.snap.core.gpf.descriptor.ToolParameterDescriptor
parameterType
-
-
Constructor Summary
Constructors Constructor Description TemplateParameterDescriptor()
TemplateParameterDescriptor(String name, Class<?> type)
TemplateParameterDescriptor(TemplateParameterDescriptor object)
Copy constructorTemplateParameterDescriptor(ToolParameterDescriptor object)
Conversion constructor from a regular parameter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addParameterDescriptor(ToolParameterDescriptor descriptor)
Adds a parameter descriptor to this template parametervoid
copyFrom(TemplateParameterDescriptor source)
String
executeTemplate(Map<String,Object> params)
Transforms (or executes) the template of this instance given a set of parameters.TemplateContext
getLastContext()
Returns the last scripting context resulted from the execution of the scripting engineFile
getOutputFile()
List<ToolParameterDescriptor>
getParameterDescriptors()
Returns the list of the parameter descriptors of this instanceTemplate
getTemplate()
Returns the template of this object.void
removeParameterDescriptor(ToolParameterDescriptor descriptor)
Removes a parameter descriptor from this template parametervoid
setOutputFile(File outputFile)
Sets the output file of this template parameter, after the template is parsed.void
setTemplate(Template template)
Sets the template of this parametervoid
setTemplateEngine(TemplateEngine engine)
Sets the scripting engine for this parameter and associates its template, if any, with the engine.-
Methods inherited from class org.esa.snap.core.gpf.descriptor.ToolParameterDescriptor
copyFrom, getAttribute, getDefaultTypedValue, getParameterType, isParameter, isTemplateAfter, isTemplateBefore, isTemplateParameter, setAttribute, setParameterType
-
Methods inherited from class org.esa.snap.core.gpf.descriptor.DefaultParameterDescriptor
getAlias, getCondition, getConverterClass, getDataMemberDescriptors, getDataType, getDefaultValue, getDescription, getDomConverterClass, getFormat, getInterval, getItemAlias, getLabel, getName, getPattern, getRasterDataNodeClass, getStructureMemberDescriptors, getUnit, getValidatorClass, getValueSet, isDeprecated, isNotEmpty, isNotNull, isSimple, isStructure, isStructure, setAlias, setCondition, setConverterClass, setDataType, setDefaultValue, setDeprecated, setDescription, setDomConverterClass, setFormat, setInterval, setItemAlias, setLabel, setName, setNotEmpty, setNotNull, setPattern, setRasterDataNodeClass, setUnit, setValidatorClass, setValueSet
-
-
-
-
Constructor Detail
-
TemplateParameterDescriptor
public TemplateParameterDescriptor()
-
TemplateParameterDescriptor
public TemplateParameterDescriptor(ToolParameterDescriptor object)
Conversion constructor from a regular parameter- Parameters:
object
- The source parameter
-
TemplateParameterDescriptor
public TemplateParameterDescriptor(TemplateParameterDescriptor object)
Copy constructor- Parameters:
object
- The template parameter to be copied.
-
-
Method Detail
-
addParameterDescriptor
public void addParameterDescriptor(ToolParameterDescriptor descriptor)
Adds a parameter descriptor to this template parameter
-
removeParameterDescriptor
public void removeParameterDescriptor(ToolParameterDescriptor descriptor)
Removes a parameter descriptor from this template parameter
-
getParameterDescriptors
public List<ToolParameterDescriptor> getParameterDescriptors()
Returns the list of the parameter descriptors of this instance
-
setTemplateEngine
public void setTemplateEngine(TemplateEngine engine) throws TemplateException
Sets the scripting engine for this parameter and associates its template, if any, with the engine.- Parameters:
engine
- The scripting engine- Throws:
TemplateException
-
getLastContext
public TemplateContext getLastContext()
Returns the last scripting context resulted from the execution of the scripting engine
-
setTemplate
public void setTemplate(Template template) throws TemplateException
Sets the template of this parameter- Parameters:
template
- The template object- Throws:
TemplateException
-
getTemplate
public Template getTemplate()
Returns the template of this object. If it has none, a new template will be created and returned.
-
executeTemplate
public String executeTemplate(Map<String,Object> params) throws TemplateException
Transforms (or executes) the template of this instance given a set of parameters.- Parameters:
params
- A collection of parameter values- Returns:
- The transformed template
- Throws:
TemplateException
-
getOutputFile
public File getOutputFile()
- Returns:
- the output file of this template parameter, after the template is parsed
-
setOutputFile
public void setOutputFile(File outputFile)
Sets the output file of this template parameter, after the template is parsed. The output file path may be a relative one or an absolute one- Parameters:
outputFile
- output file of this template parameter
-
copyFrom
public void copyFrom(TemplateParameterDescriptor source)
-
-