Class DefaultExecutionStrategy
java.lang.Object
ch.obermuhlner.scriptengine.java.execution.DefaultExecutionStrategy
- All Implemented Interfaces:
ExecutionStrategy
The default
ExecutionStrategy
implementation.
- class implements `Supplier`: the `get()` method is called
- class implements `Runnable`: the `run()` method is called
- class has exactly one public method without arguments: call it
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultExecutionStrategy
(Class<?> clazz) Constructs aDefaultExecutionStrategy
for the specifiedClass
. -
Method Summary
-
Field Details
-
clazz
-
method
-
-
Constructor Details
-
DefaultExecutionStrategy
Constructs aDefaultExecutionStrategy
for the specifiedClass
.- Parameters:
clazz
- theClass
-
-
Method Details
-
execute
Description copied from interface:ExecutionStrategy
Executes a method on an object instance, or a static method if the specified instance isnull
.- Specified by:
execute
in interfaceExecutionStrategy
- Parameters:
instance
- the object instance to be executed ornull
to execute a static method- Returns:
- the return value of the method, or
null
- Throws:
ScriptException
- if no method to execute was found
-
findCallableMethod
-