Package org.opensearch.script.mustache
Class MustacheScriptEngine
java.lang.Object
org.opensearch.script.mustache.MustacheScriptEngine
- All Implemented Interfaces:
Closeable,AutoCloseable,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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Tcompile(String templateName, String templateSource, ScriptContext<T> context, Map<String, 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.Set<ScriptContext<?>>getType()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opensearch.script.ScriptEngine
close
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
MustacheScriptEngine
public MustacheScriptEngine()
-
-
Method Details
-
compile
public <T> T compile(String templateName, String templateSource, ScriptContext<T> context, Map<String, 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 interfaceScriptEngine- Parameters:
templateSource- a string representing the template to compile.- Returns:
- a compiled template object for later execution.
-
getSupportedContexts
- Specified by:
getSupportedContextsin interfaceScriptEngine
-
getType
- Specified by:
getTypein interfaceScriptEngine
-