类 MethodInvoker

java.lang.Object
cn.taketoday.reflect.MethodInvoker
所有已实现的接口:
Accessor, Invoker, MethodAccessor
直接已知子类:
ReflectiveMethodAccessor

public abstract class MethodInvoker extends Object implements MethodAccessor, Invoker
Fast Method Invoker
从以下版本开始:
2019-10-18 22:35
作者:
Harry Yang
  • 字段详细资料

    • method

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

    • MethodInvoker

      public MethodInvoker(Method method)
  • 方法详细资料

    • invoke

      public abstract Object invoke(Object obj, Object[] args)
      Invokes the underlying method represented by this Invoker object, on the specified object with the specified parameters. Individual parameters are automatically unwrapped to match primitive formal parameters, and both primitive and reference parameters are subject to method invocation conversions as necessary.

      If the underlying method is static, then the specified obj argument is ignored. It may be null.

      If the number of formal parameters required by the underlying method is 0, the supplied args array may be of length 0 or null.

      If the underlying method is static, the class that declared the method is initialized if it has not already been initialized.

      If the method completes normally, the value it returns is returned to the caller of invoke; if the value has a primitive type, it is first appropriately wrapped in an object. However, if the value has the type of array of a primitive type, the elements of the array are not wrapped in objects; in other words, an array of primitive type is returned. If the underlying method return type is void, the invocation returns null.

      指定者:
      invoke 在接口中 Invoker
      参数:
      obj - the object the underlying method is invoked from
      args - the arguments used for the method call
      返回:
      the result of dispatching the method represented by this object on obj with parameters args
      抛出:
      NullPointerException - if the specified object is null and the method is an instance method.
      ExceptionInInitializerError - if the initialization provoked by this method fails.
    • getMethod

      public Method getMethod()
      指定者:
      getMethod 在接口中 MethodAccessor
    • fromMethod

      public static MethodInvoker fromMethod(Method executable)
      Create a MethodInvoker
      参数:
      executable - Target Method to invoke
      返回:
      MethodInvoker sub object
    • fromMethod

      public static MethodInvoker fromMethod(Method executable, Class<?> targetClass)
      Create a MethodInvoker
      参数:
      executable - Target Method to invoke
      targetClass - most specific target class
      返回:
      MethodInvoker sub object
      从以下版本开始:
      3.0
    • fromMethod

      public static MethodInvoker fromMethod(Class<?> beanClass, String name, Class<?>... parameters)
      Create a MethodInvoker
      参数:
      beanClass - Bean Class
      name - Target method to invoke
      parameters - Target parameters classes
      返回:
      MethodInvoker sub object
      抛出:
      ReflectionException - Thrown when a particular method cannot be found.
    • formReflective

      public static MethodInvoker formReflective(Method method)
    • formReflective

      public static MethodInvoker formReflective(Method method, boolean handleReflectionException)