org.rhq.helpers.perftest.support.jpa
Class JPAUtil

java.lang.Object
  extended by org.rhq.helpers.perftest.support.jpa.JPAUtil

public class JPAUtil
extends Object

A set of utility methods to work with JPA annotated classes.

Author:
Lukas Krejci

Method Summary
static Field getField(Class<?> clazz, String name)
           
static Annotations getJPAAnnotations(Class<?> clazz)
          Returns all the JPA annotations declared on the class.
static Annotations getJPAAnnotations(Field field)
          Returns all the JPA annotations declared on the field.
static Map<Field,Annotations> getJPAFields(Class<?> clazz)
          Returns all the JPA annotated fields on given class along with their annotations.
static Set<Field> getJPAFields(Class<?> clazz, Class<? extends Annotation> desiredAnnotation)
          Returns all the fields of given class that have the desired annotation defined.
static boolean isEntity(Class<?> clazz)
          Returns true if the class is annotated with Entity annotation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isEntity

public static boolean isEntity(Class<?> clazz)
Returns true if the class is annotated with Entity annotation.

Parameters:
clazz -
Returns:
true if class is a JPA entity, false otherwise

getJPAAnnotations

public static Annotations getJPAAnnotations(Class<?> clazz)
Returns all the JPA annotations declared on the class.

Parameters:
clazz -
Returns:

getJPAAnnotations

public static Annotations getJPAAnnotations(Field field)
Returns all the JPA annotations declared on the field.

Parameters:
field -
Returns:

getJPAFields

public static Map<Field,Annotations> getJPAFields(Class<?> clazz)
Returns all the JPA annotated fields on given class along with their annotations. Note that this also returns all the JPA annotated fields declared in the super classes of the provided class.

Parameters:
clazz -
Returns:

getJPAFields

public static Set<Field> getJPAFields(Class<?> clazz,
                                      Class<? extends Annotation> desiredAnnotation)
Returns all the fields of given class that have the desired annotation defined. This returns also the fields declared in the class' super classes.

Parameters:
clazz -
desiredAnnotation -
Returns:

getField

public static Field getField(Class<?> clazz,
                             String name)


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.