Package org.jline.console
Interface ScriptEngine
public interface ScriptEngine
Manage scriptEngine variables, statements and script execution.
- Author:
- Matti Rinta-Nikkola
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Deletes variables.default Object
deserialize
(String value) Deserialize valuedeserialize
(String value, String format) Deserialize valuedefault Object
Executes scriptEngine scriptExecutes scriptEngine scriptExecutes scriptEngine closureExecutes scriptEngine statementfind()
Gets all variables with valuesGets all the variables that match the name.Gets variable valueboolean
hasVariable
(String name) Tests if console variable existsvoid
Persists object value to file.void
Persists object value to file.void
Creates variableSerialize object to JSON string.Converts object fields to map.Converts object to string.
-
Method Details
-
getEngineName
String getEngineName()- Returns:
- scriptEngine name
-
getExtensions
Collection<String> getExtensions()- Returns:
- script file name extensions
-
getScriptCompleter
Completer getScriptCompleter()- Returns:
- script tab completer
-
hasVariable
Tests if console variable exists- Parameters:
name
- variable name- Returns:
- true if variable exists
-
put
Creates variable- Parameters:
name
- variable namevalue
- value
-
get
Gets variable value- Parameters:
name
- variable name- Returns:
- value of the variable
-
find
Gets all variables with values- Returns:
- map of the variables
-
find
Gets all the variables that match the name. Name can contain * wild cards.- Parameters:
name
- variable name- Returns:
- map the variables
-
del
Deletes variables. Variable name can contain * wild cards.- Parameters:
vars
- variables to be deleted
-
toJson
Serialize object to JSON string.- Parameters:
object
- object to serialize to JSON- Returns:
- formatted JSON string
-
toString
Converts object to string.- Parameters:
object
- the object- Returns:
- object string value
-
toMap
Converts object fields to map.- Parameters:
object
- the object- Returns:
- object fields map
-
deserialize
Deserialize value- Parameters:
value
- the value- Returns:
- deserialized value
-
deserialize
Deserialize value- Parameters:
value
- the valueformat
- serialization format- Returns:
- deserialized value
-
getSerializationFormats
- Returns:
- Supported serialization formats
-
getDeserializationFormats
- Returns:
- Supported deserialization formats
-
persist
Persists object value to file.- Parameters:
file
- fileobject
- object
-
persist
Persists object value to file.- Parameters:
file
- the fileobject
- the objectformat
- serialization format
-
execute
Executes scriptEngine statement- Parameters:
statement
- the statement- Returns:
- result
- Throws:
Exception
- in case of error
-
execute
Executes scriptEngine script- Parameters:
script
- the script- Returns:
- result
- Throws:
Exception
- in case of error
-
execute
Executes scriptEngine script- Parameters:
script
- the scriptargs
- arguments- Returns:
- result
- Throws:
Exception
- in case of error
-
execute
Executes scriptEngine closure- Parameters:
closure
- closureargs
- arguments- Returns:
- result
-