public class MustacheScriptEngineService extends AbstractComponent implements ScriptEngineService
Mustache
object can then be re-used for subsequent executions.Modifier and Type | Field and Description |
---|---|
static String |
NAME |
componentSettings, logger, settings
Constructor and Description |
---|
MustacheScriptEngineService(Settings settings) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
Object |
compile(String template)
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.
|
ExecutableScript |
executable(Object mustache,
Map<String,Object> vars) |
Object |
execute(Object template,
Map<String,Object> vars)
Execute a compiled template object (as retrieved from the compile method)
and fill potential place holders with the variables given.
|
String[] |
extensions() |
boolean |
sandboxed() |
void |
scriptRemoved(CompiledScript script)
Handler method called when a script is removed from the Guava cache.
|
SearchScript |
search(Object compiledScript,
SearchLookup lookup,
Map<String,Object> vars) |
String[] |
types() |
Object |
unwrap(Object value) |
nodeName
public static final String NAME
public Object compile(String template)
compile
in interface ScriptEngineService
template
- a string representing the template to compile.public Object execute(Object template, Map<String,Object> vars)
execute
in interface ScriptEngineService
template
- compiled template object.vars
- map of variables to use during substitution.public String[] types()
types
in interface ScriptEngineService
public String[] extensions()
extensions
in interface ScriptEngineService
public boolean sandboxed()
sandboxed
in interface ScriptEngineService
public ExecutableScript executable(Object mustache, @Nullable Map<String,Object> vars)
executable
in interface ScriptEngineService
public SearchScript search(Object compiledScript, SearchLookup lookup, @Nullable Map<String,Object> vars)
search
in interface ScriptEngineService
public Object unwrap(Object value)
unwrap
in interface ScriptEngineService
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public void scriptRemoved(CompiledScript script)
ScriptEngineService
scriptRemoved
in interface ScriptEngineService
Copyright © 2009–2015. All rights reserved.