Class DefaultExecutionStrategy
- java.lang.Object
-
- ch.obermuhlner.scriptengine.java.execution.DefaultExecutionStrategy
-
- All Implemented Interfaces:
ExecutionStrategy
public class DefaultExecutionStrategy extends java.lang.Object implements ExecutionStrategy
The defaultExecutionStrategyimplementation.- 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
-
-
Constructor Summary
Constructors Constructor Description DefaultExecutionStrategy(java.lang.Class<?> clazz)Constructs aDefaultExecutionStrategyfor the specifiedClass.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectexecute(java.lang.Object instance)Executes a method on an object instance, or a static method if the specified instance isnull.
-
-
-
Constructor Detail
-
DefaultExecutionStrategy
public DefaultExecutionStrategy(java.lang.Class<?> clazz)
Constructs aDefaultExecutionStrategyfor the specifiedClass.- Parameters:
clazz- theClass
-
-
Method Detail
-
execute
public java.lang.Object execute(java.lang.Object instance) throws javax.script.ScriptExceptionDescription 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:
javax.script.ScriptException- if no method to execute was found
-
-