public interface Script
Invocable
and Compilable
.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.
|
<T> T convertToInterface(Object obj, Class<T> expected)
obj
- The object to convertexpected
- The expected interfaceObject getAttribute(String name)
invoke(String, Object...)
name
- The key of the attributeObject invoke(Object instance, String name, Object... args)
instance
- The object instance to invoke the method onname
- The name of the methodargs
- The method argumentsNoSuchMethodException
- If no such method was found on the objectObject invoke(String name, Object... args)
name
- The method nameargs
- The method argumentsCopyright © 2021. All rights reserved.