public class GlobalsWrapper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
Injector |
injector |
<any> |
injectorProvider |
java.util.Map<java.lang.String,java.lang.Object> |
services |
java.util.Map<java.lang.String,java.lang.Object> |
vars |
Constructor and Description |
---|
GlobalsWrapper(<any> injectorProvider,
java.util.Map<java.lang.String,java.lang.Object> services,
java.util.Map<java.lang.String,java.lang.Object> finalObjectMap) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
exec(java.lang.String path)
Executes the script at the given path.
|
java.lang.Object |
exec(java.lang.String path,
java.lang.String arguments)
Executes the script at the given path passing on the supplied arguments.
|
CommandResult |
execCmd(java.lang.String command)
Executes a terminal command
|
<T> T |
findEntity(java.lang.Class<T> type,
java.lang.Object id)
Tries to find the entity by id.
|
java.lang.Object |
findObject(java.lang.String objectLocation,
java.lang.Class<? extends Right>... rights)
Locates an object and observes the supplied rights.
|
java.util.Collection<java.lang.Object> |
findObjects(java.lang.String objectLocation,
java.lang.Class<? extends Right>... rights)
Searches for objects and observes the supplied rights.
|
<T> java.util.List<T> |
getEntitiesByType(java.lang.Class<T> type)
Returns all entities of a given type
|
EntityManager |
getEntityManager()
Returns an
EntityManager |
<any> |
getEntityManagerProvider()
Returns an
Provider of an EntityManager |
<T> T |
getInstance(java.lang.Class<T> type)
Requests an instance from the
Injector |
<T> <any> |
getProvider(java.lang.Class<T> type)
Requests an
Provider from the Injector |
<T> T |
getRsService(java.lang.Class<T> type)
Deprecated.
|
<T> <any> |
getRsServiceProvider(java.lang.Class<T> type)
Deprecated.
|
java.lang.Class<?> |
loadClass(java.lang.String path,
java.lang.String className)
Loads a class found in the given .groovy file
|
java.util.List<java.lang.Class<?>> |
loadClasses(java.lang.String path,
java.util.List<java.lang.String> classNames)
Loads a list of classes found in the given .groovy file
|
java.lang.Object |
newInstance(java.lang.Class<?> clazz)
Creates a new instance of the given type using the no-argument constructor.
|
java.lang.Object |
newInstance(java.lang.Class<?> clazz,
java.util.List<java.lang.Class<?>> types,
java.util.List<java.lang.Object> params)
Creates a new instance of the given type using the constructor with the given
parameters.
|
java.lang.String |
read(java.lang.String identifier)
Reads in the file at the given path
|
void |
write(java.lang.String identifier,
java.lang.String data)
Writes data into a file
|
public java.util.Map<java.lang.String,java.lang.Object> services
public java.util.Map<java.lang.String,java.lang.Object> vars
public Injector injector
public <any> injectorProvider
public GlobalsWrapper(<any> injectorProvider, java.util.Map<java.lang.String,java.lang.Object> services, java.util.Map<java.lang.String,java.lang.Object> finalObjectMap)
public <T> T getInstance(java.lang.Class<T> type)
Injector
public <T> <any> getProvider(java.lang.Class<T> type)
Provider
from the Injector
@Deprecated public <T> T getRsService(java.lang.Class<T> type)
Injector
getInstance(Class)
@Deprecated public <T> <any> getRsServiceProvider(java.lang.Class<T> type)
Provider
from the Injector
getProvider(Class)
public java.lang.Object exec(java.lang.String path) throws ScriptEngineException
Executes the script at the given path.
Note that if the script contains classes, you can not use these directly. You
can use loadClass(String, String)
and
loadClasses(String, List)
in this case.
Refer to the following examples: nested classes and multiple classes.
path
- path to the scriptScriptEngineException
public java.lang.Object exec(java.lang.String path, java.lang.String arguments) throws ScriptEngineException
Executes the script at the given path passing on the supplied arguments.
Note that if the script contains classes, you can not use these directly. You
can use loadClass(String, String)
and
loadClasses(String, List)
in this case.
Refer to the following examples: nested classes and multiple classes.
path
- path to the scriptarguments
- arguments for the executionScriptEngineException
public java.lang.String read(java.lang.String identifier)
identifier
- path to filepublic java.lang.Class<?> loadClass(java.lang.String path, java.lang.String className) throws ScriptEngineException
path
- path to the .groovy file.className
- the fully qualified name of the desired class. In case the
class does not contain a package declaration, you can use
the class's name directly.ScriptEngineException
- if the class cannot be found or something else
went wrongpublic java.util.List<java.lang.Class<?>> loadClasses(java.lang.String path, java.util.List<java.lang.String> classNames) throws ScriptEngineException
path
- path to the .groovy file.classNames
- the fully qualified names of the desired classes. In case
the classes does not contain a package declaration, you can
use the classes' names directly.ScriptEngineException
- if the classes cannot be found or something
else went wrongpublic java.lang.Object newInstance(java.lang.Class<?> clazz) throws ScriptEngineException
clazz
- the type of the object to instantiateScriptEngineException
- if something went wrong during instantiationpublic java.lang.Object newInstance(java.lang.Class<?> clazz, java.util.List<java.lang.Class<?>> types, java.util.List<java.lang.Object> params) throws ScriptEngineException
clazz
- the type of the object to instantiatetypes
- the types of the constructor parametersparams
- the values of the constructor parametersScriptEngineException
- if something went wrong during instantiationpublic void write(java.lang.String identifier, java.lang.String data)
public <T> T findEntity(java.lang.Class<T> type, java.lang.Object id)
public <T> java.util.List<T> getEntitiesByType(java.lang.Class<T> type)
public EntityManager getEntityManager()
EntityManager
public <any> getEntityManagerProvider()
Provider
of an EntityManager
public CommandResult execCmd(java.lang.String command) throws TerminalException
TerminalException
public java.lang.Object findObject(java.lang.String objectLocation, java.lang.Class<? extends Right>... rights) throws ObjectResolverException
ObjectResolverException
public java.util.Collection<java.lang.Object> findObjects(java.lang.String objectLocation, java.lang.Class<? extends Right>... rights) throws ObjectResolverException
ObjectResolverException