类 MethodInvokerUtils
- java.lang.Object
- org.springframework.batch.support.MethodInvokerUtils
public class MethodInvokerUtils extends java.lang.Object
Utility methods for create MethodInvoker instances.- 从以下版本开始:
- 2.0
- 作者:
- Lucas Ward
构造器概要
构造器 构造器 说明 MethodInvokerUtils()
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static MethodInvoker
getMethodInvokerByAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, java.lang.Object target)
CreateMethodInvoker
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 aMethodInvoker
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 aMethodInvoker
using the provided interface, and method name from that interface.static <C,T>
MethodInvokergetMethodInvokerForSingleArgument(java.lang.Object target)
Create aMethodInvoker
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.
构造器详细资料
MethodInvokerUtils
public MethodInvokerUtils()
方法详细资料
getMethodInvokerByName
public static MethodInvoker getMethodInvokerByName(java.lang.Object object, java.lang.String methodName, boolean paramsRequired, java.lang.Class<?>... paramTypes)
Create aMethodInvoker
using the provided method name to search.- 参数:
object
- to be invokedmethodName
- of the method to be invokedparamsRequired
- 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.- 返回:
- 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.- 参数:
paramTypes
- types of the parameters to be used- 返回:
- String a String representation of those types
getMethodInvokerForInterface
public static MethodInvoker getMethodInvokerForInterface(java.lang.Class<?> cls, java.lang.String methodName, java.lang.Object object, java.lang.Class<?>... paramTypes)
Create aMethodInvoker
using the provided interface, and method name from that interface.- 参数:
cls
- the interface to search for the method namedmethodName
- of the method to be invokedobject
- to be invokedparamTypes
- - parameter types of the method to search for.- 返回:
- 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.- 参数:
annotationType
- the annotation to scan fortarget
- the target objectexpectedParamTypes
- the expected parameter types for the method- 返回:
- a MethodInvoker
getMethodInvokerByAnnotation
public static MethodInvoker getMethodInvokerByAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, java.lang.Object target)
CreateMethodInvoker
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.- 参数:
annotationType
- to be searched fortarget
- to be invoked- 返回:
- MethodInvoker for the provided annotation, null if none is found.
getMethodInvokerForSingleArgument
public static <C,T> MethodInvoker getMethodInvokerForSingleArgument(java.lang.Object target)
Create aMethodInvoker
for the delegate from a single public method.- 类型参数:
C
- the class.T
- the type.- 参数:
target
- an object to search for an appropriate method.- 返回:
- a
MethodInvoker
that calls a method on the delegate.