|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.synyx.hades.util.ClassUtils
public abstract class ClassUtils
Utility class to work with classes.
| Method Summary | |
|---|---|
static void |
assertReturnType(java.lang.reflect.Method method,
java.lang.Class<?>... types)
Asserts the given Method's return type to be one of the given
types. |
static java.lang.Class<?> |
getDomainClass(java.lang.Class<?> clazz)
Returns the domain class the given class is declared for. |
static java.lang.String |
getEntityName(java.lang.Class<?> domainClass)
Returns the name ot the entity represented by this class. |
static java.lang.Class<? extends java.io.Serializable> |
getIdClass(java.lang.Class<?> clazz)
Returns the id class the given class is declared for. |
static int |
getNumberOfOccurences(java.lang.reflect.Method method,
java.lang.Class<?> type)
Returns the number of occurences of the given type in the given Methods parameters. |
static java.lang.Class<?> |
getReturnedDomainClass(java.lang.reflect.Method method)
Returns the domain class returned by the given Method. |
static boolean |
hasParameterOfType(java.lang.reflect.Method method,
java.lang.Class<?> type)
Returns whether the given Method has a parameter of the given
type. |
static boolean |
isEntityManagerOfType(javax.persistence.EntityManager em,
java.lang.String type)
Returns whether the given EntityManager is of the given type. |
static boolean |
isExtendedDaoInterface(java.lang.Class<?> daoInterface)
Returns if the DAO bean to be created shall implement ExtendedGenericDao. |
static boolean |
isHadesDaoInterface(java.lang.Class<?> interfaze)
Returns wthere the given type is a Hades DAO interface. |
static boolean |
isHadesDaoInterface(java.lang.String interfaceName)
Returns whether the given type name is a Hades DAO interface name. |
static boolean |
isOfType(java.lang.Object object,
java.util.Collection<java.lang.Class<?>> types)
Returns whether the given object is of one of the given types. |
static void |
unwrapReflectionException(java.lang.Exception ex)
Helper method to extract the original exception that can possibly occur during a reflection call. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.lang.Class<?> getDomainClass(java.lang.Class<?> clazz)
GenericDao or
ExtendedGenericDao and retrieve the domain class type from its
generics declaration.
clazz -
null if
none found.public static java.lang.Class<? extends java.io.Serializable> getIdClass(java.lang.Class<?> clazz)
GenericDao or
ExtendedGenericDao and retrieve the Serializable type
from its generics declaration.
clazz -
null if none
found.public static java.lang.Class<?> getReturnedDomainClass(java.lang.reflect.Method method)
Method. Will
extract the type from Collections and Page as well.
method -
public static boolean isHadesDaoInterface(java.lang.Class<?> interfaze)
interfaze -
public static boolean isHadesDaoInterface(java.lang.String interfaceName)
interfaceName -
public static boolean isEntityManagerOfType(javax.persistence.EntityManager em,
java.lang.String type)
EntityManager is of the given type.
em - type - the fully qualified expected EntityManager type.
public static boolean isExtendedDaoInterface(java.lang.Class<?> daoInterface)
ExtendedGenericDao.
public static int getNumberOfOccurences(java.lang.reflect.Method method,
java.lang.Class<?> type)
Methods parameters.
method - type -
public static void assertReturnType(java.lang.reflect.Method method,
java.lang.Class<?>... types)
Method's return type to be one of the given
types.
method - types -
public static boolean isOfType(java.lang.Object object,
java.util.Collection<java.lang.Class<?>> types)
object - types -
public static boolean hasParameterOfType(java.lang.reflect.Method method,
java.lang.Class<?> type)
Method has a parameter of the given
type.
method - type -
public static java.lang.String getEntityName(java.lang.Class<?> domainClass)
domainClass -
public static void unwrapReflectionException(java.lang.Exception ex)
throws java.lang.Throwable
ex -
java.lang.Throwable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||