Module Environment

The Environment provides base functions for all script interpreters. It is automatically loaded by any interpreter upon startup.

Function Overview

eval Alias for execute.
execute Execute script code. This method executes script code directly in the running interpreter. Execution is done in the same thread as the caller thread.
exit Terminates script execution immediately. Code following this command will not be executed anymore.
include Include and execute a script file. Quite similar to eval(Object) a source file is opened and its content is executed. Multiple sources are available: "workspace://" opens a file relative to the workspace root, "project://" opens a file relative to the current project, "file://" opens a file from the file system. All other types of URIs are supported too (like http:// ...). You may also use absolute and relative paths as defined by your local file system.
loadJar Add a jar file to the classpath. Contents of the jar can be accessed right after loading. location can be an URI, a path, a File or an IFile instance.
wrap Creates wrapper functions for a given java instance. Searches for members and methods annotated with {@link WrapToScript} and creates wrapping code in the target script language. A method named <instance>.myMethod() will be made available by calling myMethod().

Functions

wrap

void wrap(java.lang.Object toBeWrapped)

Creates wrapper functions for a given java instance. Searches for members and methods annotated with {@link WrapToScript} and creates wrapping code in the target script language. A method named <instance>.myMethod() will be made available by calling myMethod().

Parameter Type Description
toBeWrapped java.lang.Object instance to be wrapped

execute

java.lang.Object execute(java.lang.Object data)

Execute script code. This method executes script code directly in the running interpreter. Execution is done in the same thread as the caller thread.

eval

Parameter Type Description
data java.lang.Object code to be interpreted

java.lang.Object ... result of code execution

exit

void exit(java.lang.Object value)

Terminates script execution immediately. Code following this command will not be executed anymore.

Parameter Type Description
value java.lang.Object return code

include

java.lang.Object include(java.lang.String filename)

Include and execute a script file. Quite similar to eval(Object) a source file is opened and its content is executed. Multiple sources are available: "workspace://" opens a file relative to the workspace root, "project://" opens a file relative to the current project, "file://" opens a file from the file system. All other types of URIs are supported too (like http:// ...). You may also use absolute and relative paths as defined by your local file system.

Parameter Type Description
filename java.lang.String name of file to be included

java.lang.Object ... result of include operation

loadJar

void loadJar(java.lang.Object location)

Add a jar file to the classpath. Contents of the jar can be accessed right after loading. location can be an URI, a path, a File or an IFile instance.

Parameter Type Description
location java.lang.Object URI, Path, File or IFile