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 aDefaultExecutionStrategyfor the specifiedClass. -
Method Summary
-
Field Details
-
clazz
-
method
-
-
Constructor Details
-
DefaultExecutionStrategy
Constructs aDefaultExecutionStrategyfor the specifiedClass.- Parameters:
clazz- theClass
-
-
Method Details
-
execute
Description copied from interface:ExecutionStrategyExecutes a method on an object instance, or a static method if the specified instance isnull.- Specified by:
executein interfaceExecutionStrategy- Parameters:
instance- the object instance to be executed ornullto execute a static method- Returns:
- the return value of the method, or
null - Throws:
ScriptException- if no method to execute was found
-
findCallableMethod
-