Class MustacheTemplate
java.lang.Object
org.pipservices3.expressions.mustache.MustacheTemplate
Implements an mustache template class.
-
Constructor Summary
ConstructorsConstructorDescriptionMustacheTemplate
(String template) Constructs this class and assigns mustache template. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Cleans up this calculator from all data.void
createVariables
(Map<String, Object> variables) Populates the specified variables list with variables from parsed mustache.evaluate()
Evaluates this mustache template using default variables.evaluateWithVariables
(Map<String, Object> variables) Evaluates this mustache using specified variables.boolean
Gets the flag to turn on auto creation of variables for specified mustache.The list with default variables.The list of original mustache tokens.The list of processed mustache tokens.The mustache template.getVariable
(Map<String, Object> variables, String name) Gets a variable value from the collection of variablesvoid
setAutoVariables
(boolean value) Sets the flag to turn on auto creation of variables for specified mustache.void
setOriginalTokens
(List<Token> value) void
setTemplate
(String value) The mustache template.
-
Constructor Details
-
Method Details
-
getTemplate
The mustache template. -
setTemplate
The mustache template.- Throws:
Exception
-
getOriginalTokens
-
setOriginalTokens
- Throws:
MustacheException
-
getAutoVariables
public boolean getAutoVariables()Gets the flag to turn on auto creation of variables for specified mustache. -
setAutoVariables
public void setAutoVariables(boolean value) Sets the flag to turn on auto creation of variables for specified mustache. -
getDefaultVariables
The list with default variables. -
getInitialTokens
The list of original mustache tokens. -
getResultTokens
The list of processed mustache tokens. -
getVariable
Gets a variable value from the collection of variables- Parameters:
variables
- a collection of variables.name
- a variable name to get.- Returns:
- a variable value or
undefined
-
createVariables
Populates the specified variables list with variables from parsed mustache.- Parameters:
variables
- The list of variables to be populated.
-
clear
public void clear()Cleans up this calculator from all data. -
evaluate
Evaluates this mustache template using default variables.- Returns:
- the evaluated template
- Throws:
MustacheException
-
evaluateWithVariables
Evaluates this mustache using specified variables.- Parameters:
variables
- The collection of variables- Returns:
- the evaluated template
- Throws:
MustacheException
-