Package org.springframework.data.util
Class AnnotationDetectionMethodCallback<A extends Annotation>
java.lang.Object
org.springframework.data.util.AnnotationDetectionMethodCallback<A>
- All Implemented Interfaces:
 ReflectionUtils.MethodCallback
public class AnnotationDetectionMethodCallback<A extends Annotation>
extends Object
implements ReflectionUtils.MethodCallback
ReflectionUtils.MethodCallback to find annotations of a given type.- Author:
 - Oliver Gierke, Christoph Strobl, Mark Paluch, Johannes Englmeier
 
- 
Constructor Summary
ConstructorsConstructorDescriptionAnnotationDetectionMethodCallback(Class<A> annotationType) Creates a newAnnotationDetectionMethodCallbackfor the given annotation type.AnnotationDetectionMethodCallback(Class<A> annotationType, boolean enforceUniqueness) Creates a newAnnotationDetectionMethodCallbackfor the given annotation type. - 
Method Summary
Modifier and TypeMethodDescriptionvoidReturns the method with the configured annotation.booleanReturns whether an annotation was found.<T> TInvokes the method using reflection. 
- 
Constructor Details
- 
AnnotationDetectionMethodCallback
Creates a newAnnotationDetectionMethodCallbackfor the given annotation type.- Parameters:
 annotationType- must not be null.
 - 
AnnotationDetectionMethodCallback
Creates a newAnnotationDetectionMethodCallbackfor the given annotation type.- Parameters:
 annotationType- must not be null.enforceUniqueness- whether to fail if multiple methods with the annotation are found.
 
 - 
 - 
Method Details
- 
getMethod
- Returns:
 - the method
 
 - 
getRequiredMethod
Returns the method with the configured annotation.- Returns:
 - Throws:
 IllegalStateException- in case no method with the configured annotation was found.
 - 
getAnnotation
- Returns:
 - the annotation
 
 - 
hasFoundAnnotation
public boolean hasFoundAnnotation()Returns whether an annotation was found.- Returns:
 
 - 
doWith
- Specified by:
 doWithin interfaceReflectionUtils.MethodCallback- Throws:
 IllegalArgumentExceptionIllegalAccessException
 - 
invoke
Invokes the method using reflection.- Parameters:
 target- can be null for static method invocations.args- method arguments.- Returns:
 - Since:
 - 2.7
 
 
 -