Class MustacheScriptEngine

java.lang.Object
org.opensearch.script.mustache.MustacheScriptEngine
All Implemented Interfaces:
java.io.Closeable, java.lang.AutoCloseable, ScriptEngine

public final class MustacheScriptEngine
extends java.lang.Object
implements 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.String NAME  
  • Constructor Summary

    Constructors 
    Constructor Description
    MustacheScriptEngine()  
  • Method Summary

    Modifier and Type Method Description
    <T> T compile​(java.lang.String templateName, java.lang.String templateSource, 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<ScriptContext<?>> getSupportedContexts()  
    java.lang.String getType()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.opensearch.script.ScriptEngine

    close
  • Field Details

  • Constructor Details

  • Method Details

    • compile

      public <T> T compile​(java.lang.String templateName, java.lang.String templateSource, 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:
      compile in interface ScriptEngine
      Parameters:
      templateSource - a string representing the template to compile.
      Returns:
      a compiled template object for later execution.
    • getSupportedContexts

      public java.util.Set<ScriptContext<?>> getSupportedContexts()
      Specified by:
      getSupportedContexts in interface ScriptEngine
    • getType

      public java.lang.String getType()
      Specified by:
      getType in interface ScriptEngine