Spring Data Core

org.springframework.data.util
Class AnnotationDetectionFieldCallback

java.lang.Object
  extended by 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. Thie fields type can then be accessed afterwards.

Author:
Oliver Gierke

Constructor Summary
AnnotationDetectionFieldCallback(Class<? extends Annotation> annotationType)
          Creates a new AnnotationDetectionFieldCallback scanning for an annotation of the given type.
 
Method Summary
 void doWith(Field field)
           
 Class<?> getType()
          Returns the type of the field.
<T> T
getValue(Object source)
          Retrieves the value of the field by reflection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationDetectionFieldCallback

public AnnotationDetectionFieldCallback(Class<? extends Annotation> annotationType)
Creates a new AnnotationDetectionFieldCallback scanning for an annotation of the given type.

Parameters:
annotationType - must not be null.
Method Detail

doWith

public void doWith(Field field)
            throws IllegalArgumentException,
                   IllegalAccessException
Specified by:
doWith in interface ReflectionUtils.FieldCallback
Throws:
IllegalArgumentException
IllegalAccessException

getType

public Class<?> getType()
Returns the type of the field.

Returns:

getValue

public <T> T getValue(Object source)
Retrieves the value of the field by reflection.

Parameters:
source - must not be null.
Returns:

Spring Data Core

Copyright © 2011-2013-2013 Pivotal. All Rights Reserved.