Class AnnotationMethodResolver
- java.lang.Object
- org.springframework.batch.support.AnnotationMethodResolver
- All Implemented Interfaces:
MethodResolver
public class AnnotationMethodResolver extends java.lang.Object implements MethodResolver
MethodResolverimplementation that finds a single Method on the given Class that contains the specified annotation type.- Author:
- Mark Fisher
Constructor Summary
Constructors Constructor Description AnnotationMethodResolver(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)Create aMethodResolverfor the specified Method-level annotation type.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.reflect.MethodfindMethod(java.lang.Class<?> clazz)Find a single Method on the given Class that contains the annotation type for which this resolver is searching.java.lang.reflect.MethodfindMethod(java.lang.Object candidate)Find a single Method on the Class of the given candidate object that contains the annotation type for which this resolver is searching.
Constructor Detail
AnnotationMethodResolver
public AnnotationMethodResolver(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Create aMethodResolverfor the specified Method-level annotation type.- Parameters:
annotationType- establish the annotation to be used.
Method Detail
findMethod
public java.lang.reflect.Method findMethod(java.lang.Object candidate)
Find a single Method on the Class of the given candidate object that contains the annotation type for which this resolver is searching.- Specified by:
findMethodin interfaceMethodResolver- Parameters:
candidate- the instance whose Class will be checked for the annotation- Returns:
- a single matching Method instance or
nullif the candidate's Class contains no Methods with the specified annotation - Throws:
java.lang.IllegalArgumentException- if more than one Method has the specified annotation
findMethod
public java.lang.reflect.Method findMethod(java.lang.Class<?> clazz)
Find a single Method on the given Class that contains the annotation type for which this resolver is searching.- Specified by:
findMethodin interfaceMethodResolver- Parameters:
clazz- the Class instance to check for the annotation- Returns:
- a single matching Method instance or
nullif the Class contains no Methods with the specified annotation - Throws:
java.lang.IllegalArgumentException- if more than one Method has the specified annotation