Package org.apache.groovy.groovysh.jline

# 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.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `protected static class`
  `GroovyEngine.AccessRules`
  `static interface`
  `GroovyEngine.Cloner`
  `static class`
  `GroovyEngine.EngineClassLoader`
  `static enum`
  `GroovyEngine.Format`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `ALL_CLASSES_COMPLETION`
  `static final String`
  `ALL_CONSTRUCTORS_COMPLETION`
  `static final String`
  `ALL_FIELDS_COMPLETION`
  `static final String`
  `ALL_METHODS_COMPLETION`
  `static final String`
  `CANONICAL_NAMES`
  `protected final GroovyEngine.EngineClassLoader`
  `classLoader`
  `static final String`
  `GROOVY_COLORS`
  `static final String`
  `IDENTIFIERS_COMPLETION`
  `static final String`
  `META_METHODS_COMPLETION`
  `static final String`
  `NANORC_SYNTAX`
  `static final String`
  `NANORC_VALUE`
  `static final String`
  `NO_SYNTAX_CHECK`
  `static final String`
  `RESTRICTED_COMPLETION`
  `protected Binding`
  `sharedData`
  `static final String`
  `SYNTHETIC_METHODS_COMPLETION`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GroovyEngine()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `del(String... vars)`
  `Object`
  `deserialize(String value, String formatStr)`
  `Object`
  `execute(File script, Object[] args)`
  `Object`
  `execute(Object closure, Object... args)`
  `Object`
  `execute(String statement)`
  `Map<String,Object>`
  `find(String name)`
  `Object`
  `get(String name)`
  `String`
  `getBuffer()`
  `List<String>`
  `getDeserializationFormats()`
  `String`
  `getEngineName()`
  `List<String>`
  `getExtensions()`
  `Map<String,String>`
  `getImports()`
  `Set<String>`
  `getMethodNames()`
  `Map<String,String>`
  `getMethods()`
  `GroovyEngine.Cloner`
  `getObjectCloner()`
  `org.jline.reader.Completer`
  `getScriptCompleter()`
  `List<String>`
  `getSerializationFormats()`
  `protected org.jline.builtins.SyntaxHighlighter`
  `getSyntaxHighlighter()`
  `Map<String,String>`
  `getTypes()`
  `Map<String,String>`
  `getVariables()`
  `protected <T> T`
  `groovyOption(String option, T defval)`
  `protected static <T> T`
  `groovyOption(Map<String,Object> options, String option, T defval)`
  `protected Map<String,Object>`
  `groovyOptions()`
  `boolean`
  `hasVariable(String name)`
  `void`
  `persist(Path file, Object object)`
  `void`
  `persist(Path file, Object object, String format)`
  `void`
  `purgeClassCache(String regex)`
  `void`
  `put(String name, Object value)`
  `boolean`
  `refresh()`
  `void`
  `removeImport(String name)`
  `void`
  `removeMethod(String name)`
  `void`
  `removeType(String name)`
  `void`
  `removeVariable(String name)`
  `void`
  `reset()`
  `org.jline.console.CmdDesc`
  `scriptDescription(org.jline.console.CmdLine line)`
  `void`
  `setObjectCloner(GroovyEngine.Cloner objectCloner)`
  `String`
  `toJson(Object obj)`
  `Map<String,Object>`
  `toMap(Object obj)`
  `String`
  `toString(Object obj)`

  ### Methods inherited from class java.lang.Object

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

  ### Methods inherited from interface org.jline.console.ScriptEngine

  `deserialize, execute, execute, execute, find`

- ## Field Details

  - ### CANONICAL_NAMES

    public static final String CANONICAL_NAMES
    See Also:
      - Constant Field Values

  - ### NANORC_SYNTAX

    public static final String NANORC_SYNTAX
    See Also:
      - Constant Field Values

  - ### NANORC_VALUE

    public static final String NANORC_VALUE
    See Also:
      - Constant Field Values

  - ### GROOVY_COLORS

    public static final String GROOVY_COLORS
    See Also:
      - Constant Field Values

  - ### NO_SYNTAX_CHECK

    public static final String NO_SYNTAX_CHECK
    See Also:
      - Constant Field Values

  - ### RESTRICTED_COMPLETION

    public static final String RESTRICTED_COMPLETION
    See Also:
      - Constant Field Values

  - ### ALL_FIELDS_COMPLETION

    public static final String ALL_FIELDS_COMPLETION
    See Also:
      - Constant Field Values

  - ### ALL_METHODS_COMPLETION

    public static final String ALL_METHODS_COMPLETION
    See Also:
      - Constant Field Values

  - ### ALL_CONSTRUCTORS_COMPLETION

    public static final String ALL_CONSTRUCTORS_COMPLETION
    See Also:
      - Constant Field Values

  - ### ALL_CLASSES_COMPLETION

    public static final String ALL_CLASSES_COMPLETION
    See Also:
      - Constant Field Values

  - ### IDENTIFIERS_COMPLETION

    public static final String IDENTIFIERS_COMPLETION
    See Also:
      - Constant Field Values

  - ### META_METHODS_COMPLETION

    public static final String META_METHODS_COMPLETION
    See Also:
      - Constant Field Values

  - ### SYNTHETIC_METHODS_COMPLETION

    public static final String SYNTHETIC_METHODS_COMPLETION
    See Also:
      - Constant Field Values

  - ### sharedData

    protected Binding sharedData

  - ### classLoader

    protected final GroovyEngine.EngineClassLoader classLoader

- ## 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)