public class AnnotationDetectionMethodCallback<A extends Annotation> extends Object implements ReflectionUtils.MethodCallback
ReflectionUtils.MethodCallback
to find annotations of a given type.Constructor and Description |
---|
AnnotationDetectionMethodCallback(Class<A> annotationType)
Creates a new
AnnotationDetectionMethodCallback for the given annotation type. |
AnnotationDetectionMethodCallback(Class<A> annotationType,
boolean enforceUniqueness)
Creates a new
AnnotationDetectionMethodCallback for the given annotation type. |
Modifier and Type | Method and Description |
---|---|
void |
doWith(Method method) |
A |
getAnnotation() |
Method |
getMethod() |
Method |
getRequiredMethod()
Returns the method with the configured annotation.
|
boolean |
hasFoundAnnotation()
Returns whether an annotation was found.
|
public AnnotationDetectionMethodCallback(Class<A> annotationType)
AnnotationDetectionMethodCallback
for the given annotation type.annotationType
- must not be null.public AnnotationDetectionMethodCallback(Class<A> annotationType, boolean enforceUniqueness)
AnnotationDetectionMethodCallback
for the given annotation type.annotationType
- must not be null.enforceUniqueness
- whether to fail if multiple methods with the annotation are found.public Method getRequiredMethod()
IllegalStateException
- in case no method with the configured annotation was found.public boolean hasFoundAnnotation()
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException
doWith
in interface ReflectionUtils.MethodCallback
IllegalArgumentException
IllegalAccessException
Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.