Constructor and Description |
---|
SimpleScript(CompiledScript src,
ContextProvider[] providers) |
Modifier and Type | Method and Description |
---|---|
<T> T |
convertToInterface(Object obj,
Class<T> expected)
Converts an object returned by a script to the given Java interface.
|
Object |
getAttribute(String name)
Fetches the attribute with the specified name, or null if not found.
|
Object |
invoke(Object instance,
String name,
Object... args)
Invokes a method on the given object, which should be a return value or scripting object.
|
Object |
invoke(String name,
Object... args)
Invokes a root-level method using the method name and args and returns the result.
|
void |
setAttribute(String name,
Object value)
Sets the attribute with the given name and value.
|
public SimpleScript(CompiledScript src, ContextProvider[] providers) throws ScriptException
ScriptException
public <T> T convertToInterface(Object obj, Class<T> expected)
Script
convertToInterface
in interface Script
obj
- The object to convertexpected
- The expected interfacepublic Object getAttribute(String name)
Script
Script.invoke(String, Object...)
getAttribute
in interface Script
name
- The key of the attributepublic Object invoke(Object instance, String name, Object... args)
Script
public Object invoke(String name, Object... args)
Script
public void setAttribute(String name, Object value)
Script
setAttribute
in interface Script
Copyright © 2021. All rights reserved.