Package org.springframework.data.util
Class AnnotationDetectionFieldCallback
java.lang.Object
org.springframework.data.util.AnnotationDetectionFieldCallback
- All Implemented Interfaces:
- ReflectionUtils.FieldCallback
public class AnnotationDetectionFieldCallback
extends Object
implements ReflectionUtils.FieldCallback
A 
ReflectionUtils.FieldCallback that will inspect each field for a given annotation. This field's type can then be accessed
 afterwards.- Author:
- Oliver Gierke, Christoph Strobl, Mark Paluch, Johannes Englmeier
- 
Constructor SummaryConstructorsConstructorDescriptionAnnotationDetectionFieldCallback(Class<? extends Annotation> annotationType) Creates a newAnnotationDetectionFieldCallbackscanning for an annotation of the given type.
- 
Method SummaryModifier and TypeMethodDescriptionvoidgetField()Returns the detected field.Returns the field that was detected.Class<?>Returns the type of the field or throws anIllegalArgumentExceptionif no field could be found.Class<?>getType()Returns the type of the field.<T> TRetrieves the value of the field by reflection.
- 
Constructor Details- 
AnnotationDetectionFieldCallbackCreates a newAnnotationDetectionFieldCallbackscanning for an annotation of the given type.- Parameters:
- annotationType- must not be null.
 
 
- 
- 
Method Details- 
doWith- Specified by:
- doWithin interface- ReflectionUtils.FieldCallback
- Throws:
- IllegalArgumentException
- IllegalAccessException
 
- 
getFieldReturns the detected field.- Returns:
- the field
 
- 
getRequiredFieldReturns the field that was detected.- Returns:
- Throws:
- IllegalStateException- in case no field with the configured annotation was found.
 
- 
getTypeReturns the type of the field.- Returns:
 
- 
getRequiredTypeReturns the type of the field or throws anIllegalArgumentExceptionif no field could be found.- Returns:
- Throws:
- IllegalStateException- in case no field with the configured annotation was found.
 
- 
getValueRetrieves the value of the field by reflection.- Parameters:
- source- must not be null.
- Returns:
 
 
-