Top Description Fields Constructors Methods
org.hibernate.annotations.common.util

public final Class ReflectHelper

extends Object
Class Inheritance
Imports
java.lang.reflect.Member, .Method, .Modifier, org.hibernate.annotations.common.AssertionFailure

Complete duplication of org.hibernate.util.ReflectHelper.
Author
Emmanuel Bernard

Field Summary

Modifier and TypeField and Description
public static final Class<T>[]
public static final Object[]
private static final Method
private static final Method
public static final Class<T>[]

Constructor Summary

AccessConstructor and Description
private
ReflectHelper()

Disallow instantiation of ReflectHelper.

Method Summary

Modifier and TypeMethod and Description
public static Class<T>

Returns:

The class reference.
classForName
(String
The class name
name
,
Class<T>
The class from which this call originated (in order to access that class's loader).
caller
)

Perform resolution of a class name.

public static Class<T>

Returns:

The class reference.
classForName
(String
The class name
name
)

Perform resolution of a class name.

public static Method

Returns:

The equals method reference
extractEqualsMethod
(Class<T>
The class from which to extract the equals method.
clazz
)

Encapsulation of getting hold of a class's equals method.

public static Method

Returns:

The hashCode method reference
extractHashCodeMethod
(Class<T>
The class from which to extract the hashCode method.
clazz
)

Encapsulation of getting hold of a class's hashCode method.

public static Object

Returns:

The value
getConstantValue
(String
The name
name
)

Resolve a constant to its actual value.

public static Method
getMethod(Class<T> clazz, Method method)

public static boolean

Returns:

True if the class is abstract, false otherwise.
isAbstractClass
(Class<T>
The class to check.
clazz
)

Determine if the given class is declared abstract.

public static boolean

Returns:

True if the class is final, flase otherwise.
isFinalClass
(Class<T>
The class to check.
clazz
)

Determine is the given class is declared final.

public static boolean

Returns:

True if the member is publicly accessible, false otherwise.
isPublic
(Class<T>
The class which defines the member
clazz
,
Member
The memeber.
member
)

Is this member publicly accessible.

public static boolean

Returns:

True if clazz defines an equals override.
overridesEquals
(Class<T>
The class to check
clazz
)

Determine if the given class defines an Object#equals override.

public static boolean

Returns:

True if clazz defines an hashCode override.
overridesHashCode
(Class<T>
The class to check
clazz
)

Determine if the given class defines a Object#hashCode override.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

NO_PARAM_SIGNATUREback to summary
public static final Class<T>[] NO_PARAM_SIGNATURE
NO_PARAMSback to summary
public static final Object[] NO_PARAMS
OBJECT_EQUALSback to summary
private static final Method OBJECT_EQUALS
OBJECT_HASHCODEback to summary
private static final Method OBJECT_HASHCODE
SINGLE_OBJECT_PARAM_SIGNATUREback to summary
public static final Class<T>[] SINGLE_OBJECT_PARAM_SIGNATURE

Constructor Detail

ReflectHelperback to summary
private ReflectHelper()

Disallow instantiation of ReflectHelper.

Method Detail

classForNameback to summary
public static Class<T> classForName(String name, Class<T> caller) throws ClassNotFoundException

Perform resolution of a class name.

Here we first check the context classloader, if one, before delegating to Class#forName(String, boolean, ClassLoader) using the caller's classloader

Parameters
name:String

The class name

caller:Class<T>

The class from which this call originated (in order to access that class's loader).

Returns:Class<T>

The class reference.

Exceptions
ClassNotFoundException:
From Class#forName(String, boolean, ClassLoader).
classForNameback to summary
public static Class<T> classForName(String name) throws ClassNotFoundException

Perform resolution of a class name.

Same as classForName(String, Class) except that here we delegate to Class#forName(String) if the context classloader lookup is unsuccessful.

Parameters
name:String

The class name

Returns:Class<T>

The class reference.

Exceptions
ClassNotFoundException:
From Class#forName(String).
extractEqualsMethodback to summary
public static Method extractEqualsMethod(Class<T> clazz) throws NoSuchMethodException

Encapsulation of getting hold of a class's equals method.

Parameters
clazz:Class<T>

The class from which to extract the equals method.

Returns:Method

The equals method reference

Exceptions
NoSuchMethodException:
Should indicate an attempt to extract equals method from interface.
extractHashCodeMethodback to summary
public static Method extractHashCodeMethod(Class<T> clazz) throws NoSuchMethodException

Encapsulation of getting hold of a class's hashCode method.

Parameters
clazz:Class<T>

The class from which to extract the hashCode method.

Returns:Method

The hashCode method reference

Exceptions
NoSuchMethodException:
Should indicate an attempt to extract hashCode method from interface.
getConstantValueback to summary
public static Object getConstantValue(String name)

Resolve a constant to its actual value.

Parameters
name:String

The name

Returns:Object

The value

getMethodback to summary
public static Method getMethod(Class<T> clazz, Method method)
isAbstractClassback to summary
public static boolean isAbstractClass(Class<T> clazz)

Determine if the given class is declared abstract.

Parameters
clazz:Class<T>

The class to check.

Returns:boolean

True if the class is abstract, false otherwise.

isFinalClassback to summary
public static boolean isFinalClass(Class<T> clazz)

Determine is the given class is declared final.

Parameters
clazz:Class<T>

The class to check.

Returns:boolean

True if the class is final, flase otherwise.

isPublicback to summary
public static boolean isPublic(Class<T> clazz, Member member)

Is this member publicly accessible.

Parameters
clazz:Class<T>

The class which defines the member

member:Member

The memeber.

Returns:boolean

True if the member is publicly accessible, false otherwise.

overridesEqualsback to summary
public static boolean overridesEquals(Class<T> clazz)

Determine if the given class defines an Object#equals override.

Parameters
clazz:Class<T>

The class to check

Returns:boolean

True if clazz defines an equals override.

overridesHashCodeback to summary
public static boolean overridesHashCode(Class<T> clazz)

Determine if the given class defines a Object#hashCode override.

Parameters
clazz:Class<T>

The class to check

Returns:boolean

True if clazz defines an hashCode override.