net.sf.jsefa.common.annotation
Class AnnotatedFieldsProvider

java.lang.Object
  extended by net.sf.jsefa.common.annotation.AnnotatedFieldsProvider

public final class AnnotatedFieldsProvider
extends Object

Provider for anotated fields.

Author:
Norman Lahme-Huetig

Method Summary
static List<Field> getAnnotatedFields(Class<?> objectType, Class<? extends Annotation>... annotationClasses)
          Returns all fields of the given object type or one of its ancestors which are annotated with at least one of the given annotation classes.
static List<Field> getSortedAnnotatedFields(Class<?> objectType, Class<? extends Annotation>... annotationClasses)
          Returns a list of fields which are annotated in the given objectType with one of the given annotation classes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSortedAnnotatedFields

public static List<Field> getSortedAnnotatedFields(Class<?> objectType,
                                                   Class<? extends Annotation>... annotationClasses)
Returns a list of fields which are annotated in the given objectType with one of the given annotation classes. The fields are sorted according to their respective position values with the following semantics:

If the position of a field A is less than the position of a field B, than field A comes (not necessarily directly) before field B.
All fields with the default position value (-1) will come after all fields with explicit positions.

Parameters:
objectType - the object type
annotationClasses - the annotation classes
Returns:
a sorted list of fields

getAnnotatedFields

public static List<Field> getAnnotatedFields(Class<?> objectType,
                                             Class<? extends Annotation>... annotationClasses)
Returns all fields of the given object type or one of its ancestors which are annotated with at least one of the given annotation classes.
Note: there is no commitment to a specific order for the returned list of fields.

Parameters:
objectType - the object type
annotationClasses - the annotation classes
Returns:
the list of fields.


Copyright © 2014. All rights reserved.