public abstract class ReflectionHelper extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
containsSearchAnnotations(org.hibernate.annotations.common.reflection.XClass mappedClass)
Checks whether the specified class contains any Search-specific annotations.
|
static Object |
createInstance(Class<?> clazz,
boolean checkForFactoryAnnotation)
Creates an instance of the specified class and returns it.
|
static List<org.hibernate.annotations.common.reflection.XClass> |
createXClassHierarchy(org.hibernate.annotations.common.reflection.XClass clazz)
Creates the class hierarchy for a given
XClass . |
static String |
getAttributeName(org.hibernate.annotations.common.reflection.XMember member,
String name)
Get attribute name out of member unless overridden by
name . |
static Object |
getMemberValue(Object bean,
org.hibernate.annotations.common.reflection.XMember getter) |
static boolean |
isFloatingPointType(Class<?> type)
Checks whether the specified type is a floating point type.
|
static boolean |
isIntegerType(Class<?> type)
Checks whether the specified type is a integer type.
|
static boolean |
isSearchAnnotation(Annotation annotation)
Checks if the annotation is a Search annotation by comparing the package of the annotation.
|
static void |
setAccessible(AccessibleObject member)
Always use this method to set accessibility regardless of the visibility.
|
static void |
setAccessible(org.hibernate.annotations.common.reflection.XMember member)
Always use this method to set accessibility regardless of the visibility.
|
public static String getAttributeName(org.hibernate.annotations.common.reflection.XMember member, String name)
name
.member
- XMember
from which to extract the name.name
- Override value which will be returned in case it is not empty.name
.public static void setAccessible(org.hibernate.annotations.common.reflection.XMember member)
member
- the XMember
to checkpublic static void setAccessible(AccessibleObject member)
member
- the AccessibleObject
to changepublic static Object getMemberValue(Object bean, org.hibernate.annotations.common.reflection.XMember getter)
public static List<org.hibernate.annotations.common.reflection.XClass> createXClassHierarchy(org.hibernate.annotations.common.reflection.XClass clazz)
XClass
.clazz
- the class for which to create the hierarchyjava.lang.Object
public static boolean containsSearchAnnotations(org.hibernate.annotations.common.reflection.XClass mappedClass)
This method will return true
if such an annotation is detected
in the class itself or in one of its superclass, either applied directly on the class,
on a field, or on a method.
mappedClass
- the XClass
to check for Search annotationstrue
if the class contains at least one Search annotation, false
otherwisepublic static boolean isSearchAnnotation(Annotation annotation)
annotation
- the annotation to checktrue
if the annotation is a Search annotation, false
otherwisepublic static Object createInstance(Class<?> clazz, boolean checkForFactoryAnnotation)
checkForFactoryAnnotation == true
, the created
instance is checked for a @Factory
annotated method. If one exists the factory method is invoked and the
return value returns as expected instances.clazz
- the class to instantiatecheckForFactoryAnnotation
- whether to check for @Factory
annotated methodspublic static boolean isFloatingPointType(Class<?> type)
type
- the type to checktrue
if the specified type is an floating point type or a wrapper thereof. false
otherwise.public static boolean isIntegerType(Class<?> type)
type
- the type to checktrue
if the specified type is an primitive integer type or a wrapper thereof. false
otherwise.Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved