org.springframework.batch.support

## Class MethodInvokerUtils

- java.lang.Object
- - org.springframework.batch.support.MethodInvokerUtils

-     public class MethodInvokerUtils
      extends java.lang.Object

  Utility methods for create MethodInvoker instances.
  Since:
    2.0
  Author:
    Lucas Ward

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MethodInvokerUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static MethodInvoker` | `getMethodInvokerByAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, java.lang.Object target)` Create `MethodInvoker` for the method with the provided annotation on the provided object.
    `static MethodInvoker` | `getMethodInvokerByAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, java.lang.Object target, java.lang.Class<?>... expectedParamTypes)` Create a MethodInvoker from the delegate based on the annotationType.
    `static MethodInvoker` | `getMethodInvokerByName(java.lang.Object object, java.lang.String methodName, boolean paramsRequired, java.lang.Class<?>... paramTypes)` Create a `MethodInvoker` using the provided method name to search.
    `static MethodInvoker` | `getMethodInvokerForInterface(java.lang.Class<?> cls, java.lang.String methodName, java.lang.Object object, java.lang.Class<?>... paramTypes)` Create a `MethodInvoker` using the provided interface, and method name from that interface.
    `static <C,T> MethodInvoker` | `getMethodInvokerForSingleArgument(java.lang.Object target)` Create a `MethodInvoker` for the delegate from a single public method.
    `static java.lang.String` | `getParamTypesString(java.lang.Class<?>... paramTypes)` Create a String representation of the array of parameter types.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MethodInvokerUtils

          public MethodInvokerUtils()

  - ### Method Detail

    - #### getMethodInvokerByName

          public static MethodInvoker getMethodInvokerByName(java.lang.Object object,
                                                             java.lang.String methodName,
                                                             boolean paramsRequired,
                                                             java.lang.Class<?>... paramTypes)

      Create a `MethodInvoker` using the provided method name to search.
      Parameters:
        `object` - to be invoked
        `methodName` - of the method to be invoked
        `paramsRequired` - boolean indicating whether the parameters are required, if false, a no args version of the method will be searched for.
        `paramTypes` - - parameter types of the method to search for.
      Returns:
        MethodInvoker if the method is found, null if it is not.

    - #### getParamTypesString

          public static java.lang.String getParamTypesString(java.lang.Class<?>... paramTypes)

      Create a String representation of the array of parameter types.
      Parameters:
        `paramTypes` -
      Returns:
        String

    - #### getMethodInvokerForInterface

          public static MethodInvoker getMethodInvokerForInterface(java.lang.Class<?> cls,
                                                                   java.lang.String methodName,
                                                                   java.lang.Object object,
                                                                   java.lang.Class<?>... paramTypes)

      Create a `MethodInvoker` using the provided interface, and method name from that interface.
      Parameters:
        `cls` - the interface to search for the method named
        `methodName` - of the method to be invoked
        `object` - to be invoked
        `paramTypes` - - parameter types of the method to search for.
      Returns:
        MethodInvoker if the method is found, null if it is not.

    - #### getMethodInvokerByAnnotation

          public static MethodInvoker getMethodInvokerByAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
                                                                   java.lang.Object target,
                                                                   java.lang.Class<?>... expectedParamTypes)

      Create a MethodInvoker from the delegate based on the annotationType. Ensure that the annotated method has a valid set of parameters.
      Parameters:
        `annotationType` - the annotation to scan for
        `target` - the target object
        `expectedParamTypes` - the expected parameter types for the method
      Returns:
        a MethodInvoker

    - #### getMethodInvokerByAnnotation

          public static MethodInvoker getMethodInvokerByAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
                                                                   java.lang.Object target)

      Create `MethodInvoker` for the method with the provided annotation on the provided object. Annotations that cannot be applied to methods (i.e. that aren't annotated with an element type of METHOD) will cause an exception to be thrown.
      Parameters:
        `annotationType` - to be searched for
        `target` - to be invoked
      Returns:
        MethodInvoker for the provided annotation, null if none is found.

    - #### getMethodInvokerForSingleArgument

          public static <C,T> MethodInvoker getMethodInvokerForSingleArgument(java.lang.Object target)

      Create a `MethodInvoker` for the delegate from a single public method.
      Parameters:
        `target` - an object to search for an appropriate method
      Returns:
        a MethodInvoker that calls a method on the delegate