Class MustacheScriptEngine
java.lang.Object
org.elasticsearch.script.mustache.MustacheScriptEngine
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,org.elasticsearch.script.ScriptEngine
public final class MustacheScriptEngine
extends java.lang.Object
implements org.elasticsearch.script.ScriptEngine
Main entry point handling template registration, compilation and
execution.
Template handling is based on Mustache. Template handling is a two step
process: First compile the string representing the template, the resulting
Mustache object can then be re-used for subsequent executions.-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNAME -
Constructor Summary
Constructors Constructor Description MustacheScriptEngine() -
Method Summary
Modifier and Type Method Description <T> Tcompile(java.lang.String templateName, java.lang.String templateSource, org.elasticsearch.script.ScriptContext<T> context, java.util.Map<java.lang.String,java.lang.String> options)Compile a template string to (in this case) a Mustache object than can later be re-used for execution to fill in missing parameter values.java.util.Set<org.elasticsearch.script.ScriptContext<?>>getSupportedContexts()java.lang.StringgetType()
-
Field Details
-
NAME
public static final java.lang.String NAME- See Also:
- Constant Field Values
-
-
Constructor Details
-
MustacheScriptEngine
public MustacheScriptEngine()
-
-
Method Details
-
compile
public <T> T compile(java.lang.String templateName, java.lang.String templateSource, org.elasticsearch.script.ScriptContext<T> context, java.util.Map<java.lang.String,java.lang.String> options)Compile a template string to (in this case) a Mustache object than can later be re-used for execution to fill in missing parameter values.- Specified by:
compilein interfaceorg.elasticsearch.script.ScriptEngine- Parameters:
templateSource- a string representing the template to compile.- Returns:
- a compiled template object for later execution.
-
getSupportedContexts
public java.util.Set<org.elasticsearch.script.ScriptContext<?>> getSupportedContexts()- Specified by:
getSupportedContextsin interfaceorg.elasticsearch.script.ScriptEngine
-
getType
public java.lang.String getType()- Specified by:
getTypein interfaceorg.elasticsearch.script.ScriptEngine
-