Class GroovyEngine

java.lang.Object
org.apache.groovy.groovysh.jline.GroovyEngine
All Implemented Interfaces:
org.jline.console.ScriptEngine

public class GroovyEngine extends Object implements org.jline.console.ScriptEngine
Implements Groovy ScriptEngine. You must be very careful when using GroovyEngine in a multithreaded environment. The Binding instance is not thread safe, and it is shared by all scripts.
  • Field Details

  • Constructor Details

    • GroovyEngine

      public GroovyEngine()
  • Method Details

    • getTypes

      public Map<String,String> getTypes()
    • getVariables

      public Map<String,String> getVariables()
    • getMethods

      public Map<String,String> getMethods()
    • getMethodNames

      public Set<String> getMethodNames()
    • getImports

      public Map<String,String> getImports()
    • getScriptCompleter

      public org.jline.reader.Completer getScriptCompleter()
      Specified by:
      getScriptCompleter in interface org.jline.console.ScriptEngine
    • hasVariable

      public boolean hasVariable(String name)
      Specified by:
      hasVariable in interface org.jline.console.ScriptEngine
    • put

      public void put(String name, Object value)
      Specified by:
      put in interface org.jline.console.ScriptEngine
    • get

      public Object get(String name)
      Specified by:
      get in interface org.jline.console.ScriptEngine
    • find

      public Map<String,Object> find(String name)
      Specified by:
      find in interface org.jline.console.ScriptEngine
    • getSerializationFormats

      public List<String> getSerializationFormats()
      Specified by:
      getSerializationFormats in interface org.jline.console.ScriptEngine
    • getDeserializationFormats

      public List<String> getDeserializationFormats()
      Specified by:
      getDeserializationFormats in interface org.jline.console.ScriptEngine
    • deserialize

      public Object deserialize(String value, String formatStr)
      Specified by:
      deserialize in interface org.jline.console.ScriptEngine
    • persist

      public void persist(Path file, Object object)
      Specified by:
      persist in interface org.jline.console.ScriptEngine
    • persist

      public void persist(Path file, Object object, String format)
      Specified by:
      persist in interface org.jline.console.ScriptEngine
    • execute

      public Object execute(File script, Object[] args) throws Exception
      Specified by:
      execute in interface org.jline.console.ScriptEngine
      Throws:
      Exception
    • getBuffer

      public String getBuffer()
    • execute

      public Object execute(String statement) throws Exception
      Specified by:
      execute in interface org.jline.console.ScriptEngine
      Throws:
      Exception
    • execute

      public Object execute(Object closure, Object... args)
      Specified by:
      execute in interface org.jline.console.ScriptEngine
    • getEngineName

      public String getEngineName()
      Specified by:
      getEngineName in interface org.jline.console.ScriptEngine
    • getExtensions

      public List<String> getExtensions()
      Specified by:
      getExtensions in interface org.jline.console.ScriptEngine
    • reset

      public void reset()
    • removeMethod

      public void removeMethod(String name)
    • removeImport

      public void removeImport(String name)
    • removeType

      public void removeType(String name)
    • removeVariable

      public void removeVariable(String name)
    • del

      public void del(String... vars)
      Specified by:
      del in interface org.jline.console.ScriptEngine
    • toJson

      public String toJson(Object obj)
      Specified by:
      toJson in interface org.jline.console.ScriptEngine
    • toString

      public String toString(Object obj)
      Specified by:
      toString in interface org.jline.console.ScriptEngine
    • toMap

      public Map<String,Object> toMap(Object obj)
      Specified by:
      toMap in interface org.jline.console.ScriptEngine
    • setObjectCloner

      public void setObjectCloner(GroovyEngine.Cloner objectCloner)
    • getObjectCloner

      public GroovyEngine.Cloner getObjectCloner()
    • scriptDescription

      public org.jline.console.CmdDesc scriptDescription(org.jline.console.CmdLine line)
    • groovyOptions

      protected Map<String,Object> groovyOptions()
    • groovyOption

      protected <T> T groovyOption(String option, T defval)
    • groovyOption

      protected static <T> T groovyOption(Map<String,Object> options, String option, T defval)
    • refresh

      public boolean refresh()
    • getSyntaxHighlighter

      protected org.jline.builtins.SyntaxHighlighter getSyntaxHighlighter()
    • purgeClassCache

      public void purgeClassCache(String regex)