org.apache.myfaces.extensions.validator.util
Class ExtValAnnotationUtils

java.lang.Object
  extended by org.apache.myfaces.extensions.validator.util.ExtValAnnotationUtils

public class ExtValAnnotationUtils
extends Object

Contains helper methods which are dealing with general tasks liked to annotation

Since:
r4
Author:
Gerhard Petracek

Constructor Summary
ExtValAnnotationUtils()
           
 
Method Summary
static void addFieldAccessAnnotations(PropertyStorage storage, Class entity, String property, PropertyInformation propertyInformation)
          Extracts all annotations found at the field of the property.
static void addPropertyAccessAnnotations(PropertyStorage storage, Class entity, String property, PropertyInformation propertyInformation)
          Extracts all annotations found at the getter method of a property.
static PropertyInformation extractAnnotations(Class entityClass, PropertyDetails propertyDetails)
          Extracts all annotations found on a property.
static
<T> T
extractValueOf(Annotation annotation, Class<T> targetClass)
          Extracts the value of the given annotation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtValAnnotationUtils

public ExtValAnnotationUtils()
Method Detail

extractAnnotations

public static PropertyInformation extractAnnotations(Class entityClass,
                                                     PropertyDetails propertyDetails)
Extracts all annotations found on a property. It looks for them on getter method, the field and all getters that are defined in interfaces. The name of the target property is provided by the propertyDetails parameter.

Parameters:
entityClass - target class which has to be scanned
propertyDetails - information about the property
Returns:
a datastructure which contains all information about the target-property

addPropertyAccessAnnotations

public static void addPropertyAccessAnnotations(PropertyStorage storage,
                                                Class entity,
                                                String property,
                                                PropertyInformation propertyInformation)
Extracts all annotations found at the getter method of a property. The annotations are added to the given propertyInformation parameter.

Parameters:
storage - PropertyStorage which is able to cache information of a property
entity - target class which has to be scanned
property - Name of the property we are interested in.
propertyInformation - Where the MetaDataEntries for the annotations are added.

addFieldAccessAnnotations

public static void addFieldAccessAnnotations(PropertyStorage storage,
                                             Class entity,
                                             String property,
                                             PropertyInformation propertyInformation)
Extracts all annotations found at the field of the property. A field name with a _ (underscore) as prefix is also supported. The annotations are added to the given propertyInformation parameter.

Parameters:
storage - PropertyStorage which is able to cache information of a property
entity - target class which has to be scanned
property - Name of the property we are interested in.
propertyInformation - Where the MetaDataEntries for the annotations are added.

extractValueOf

public static <T> T extractValueOf(Annotation annotation,
                                   Class<T> targetClass)
Extracts the value of the given annotation.

Type Parameters:
T - Result class
Parameters:
annotation - The target annotation
targetClass - Type of the value-property
Returns:
value of the value-property


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.