类 DefaultExecutionStrategy

java.lang.Object
com.obermuhlner.scriptengine.java.execution.DefaultExecutionStrategy
所有已实现的接口:
ExecutionStrategy

public class DefaultExecutionStrategy extends Object implements 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
  • 字段详细资料

    • clazz

      private final Class<?> clazz
    • method

      private final Method method
  • 构造器详细资料

  • 方法详细资料

    • execute

      public Object execute(Object instance) throws ScriptException
      从接口复制的说明: ExecutionStrategy
      Executes a method on an object instance, or a static method if the specified instance is null.
      指定者:
      execute 在接口中 ExecutionStrategy
      参数:
      instance - the object instance to be executed or null to execute a static method
      返回:
      the return value of the method, or null
      抛出:
      ScriptException - if no method to execute was found
    • findCallableMethod

      private static Method findCallableMethod(Class<?> clazz)