|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hibernate.util.ReflectHelper
public final class ReflectHelper
Utility class for various reflection operations.
| Field Summary | |
|---|---|
static Class[] |
NO_PARAM_SIGNATURE
|
static Object[] |
NO_PARAMS
|
static Class[] |
SINGLE_OBJECT_PARAM_SIGNATURE
|
| Method Summary | |
|---|---|
static Class |
classForName(String name)
Perform resolution of a class name. |
static Class |
classForName(String name,
Class caller)
Perform resolution of a class name. |
static Method |
extractEqualsMethod(Class clazz)
Encapsulation of getting hold of a class's equals method. |
static Method |
extractHashCodeMethod(Class clazz)
Encapsulation of getting hold of a class's hashCode method. |
static Object |
getConstantValue(String name)
Resolve a constant to its actual value. |
static Constructor |
getConstructor(Class clazz,
Type[] types)
Retrieve a constructor for the given class, with arguments matching the specified Hibernate mapping types. |
static Constructor |
getDefaultConstructor(Class clazz)
Retrieve the default (no arg) constructor from the given class. |
static Getter |
getGetter(Class theClass,
String name)
Directly retrieve the Getter reference via the BasicPropertyAccessor. |
static Method |
getMethod(Class clazz,
Method method)
|
static boolean |
implementsInterface(Class clazz,
Class intf)
Determine if the given class implements the given interface. |
static boolean |
isAbstractClass(Class clazz)
Determine if the given class is declared abstract. |
static boolean |
isFinalClass(Class clazz)
Determine is the given class is declared final. |
static boolean |
isPublic(Class clazz,
Member member)
Is this member publicly accessible. |
static boolean |
isPublic(Member member)
Is this member publicly accessible. |
static boolean |
overridesEquals(Class clazz)
Determine if the given class defines an Object.equals(java.lang.Object) override. |
static boolean |
overridesHashCode(Class clazz)
Determine if the given class defines a Object.hashCode() override. |
static Class |
reflectedPropertyClass(String className,
String name)
Attempt to resolve the specified property type through reflection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Class[] NO_PARAM_SIGNATURE
public static final Object[] NO_PARAMS
public static final Class[] SINGLE_OBJECT_PARAM_SIGNATURE
| Method Detail |
|---|
public static Method extractEqualsMethod(Class clazz)
throws NoSuchMethodException
equals method.
clazz - The class from which to extract the equals method.
NoSuchMethodException - Should indicate an attempt to extract equals method from interface.
public static Method extractHashCodeMethod(Class clazz)
throws NoSuchMethodException
hashCode method.
clazz - The class from which to extract the hashCode method.
NoSuchMethodException - Should indicate an attempt to extract hashCode method from interface.public static boolean overridesEquals(Class clazz)
Object.equals(java.lang.Object) override.
clazz - The class to check
public static boolean overridesHashCode(Class clazz)
Object.hashCode() override.
clazz - The class to check
public static boolean implementsInterface(Class clazz,
Class intf)
clazz - The class to checkintf - The interface to check it against.
public static Class classForName(String name,
Class caller)
throws ClassNotFoundException
Class.forName(String, boolean, ClassLoader) using the caller's classloader
name - The class namecaller - The class from which this call originated (in order to access that class's loader).
ClassNotFoundException - From Class.forName(String, boolean, ClassLoader).
public static Class classForName(String name)
throws ClassNotFoundException
classForName(String, Class) except that here we delegate to
Class.forName(String) if the context classloader lookup is unsuccessful.
name - The class name
ClassNotFoundException - From Class.forName(String).public static boolean isPublic(Member member)
isPublic(Class, Member) passing the member + Member.getDeclaringClass()
member - The member to check
public static boolean isPublic(Class clazz,
Member member)
clazz - The class which defines the membermember - The memeber.
public static Class reflectedPropertyClass(String className,
String name)
throws MappingException
className - The name of the class owning the property.name - The name of the property.
MappingException - Indicates we were unable to locate the property.
public static Getter getGetter(Class theClass,
String name)
throws MappingException
Getter reference via the BasicPropertyAccessor.
theClass - The class owning the propertyname - The name of the property
MappingException - Indicates we were unable to locate the property.public static Object getConstantValue(String name)
name - The name
public static Constructor getDefaultConstructor(Class clazz)
throws PropertyNotFoundException
clazz - The class for which to retrieve the default ctor.
PropertyNotFoundException - Indicates there was not publicly accessible, no-arg constructor (todo : why PropertyNotFoundException???)public static boolean isAbstractClass(Class clazz)
clazz - The class to check.
public static boolean isFinalClass(Class clazz)
clazz - The class to check.
public static Constructor getConstructor(Class clazz,
Type[] types)
throws PropertyNotFoundException
types.
clazz - The class needing instantiationtypes - The types representing the required ctor param signature
PropertyNotFoundException - Indicates we could not locate an appropriate constructor (todo : again with PropertyNotFoundException???)
public static Method getMethod(Class clazz,
Method method)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||