Hibernate Commons Annotations 3.2.0.Final-redhat-2

org.hibernate.annotations.common.util
Class ReflectHelper

java.lang.Object
  extended by org.hibernate.annotations.common.util.ReflectHelper

public final class ReflectHelper
extends Object

Complete duplication of org.hibernate.util.ReflectHelper.

Author:
Emmanuel Bernard

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 Method getMethod(Class clazz, Method method)
           
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 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_PARAM_SIGNATURE

public static final Class[] NO_PARAM_SIGNATURE

NO_PARAMS

public static final Object[] NO_PARAMS

SINGLE_OBJECT_PARAM_SIGNATURE

public static final Class[] SINGLE_OBJECT_PARAM_SIGNATURE
Method Detail

extractEqualsMethod

public static Method extractEqualsMethod(Class clazz)
                                  throws NoSuchMethodException
Encapsulation of getting hold of a class's equals method.

Parameters:
clazz - The class from which to extract the equals method.
Returns:
The equals method reference
Throws:
NoSuchMethodException - Should indicate an attempt to extract equals method from interface.

extractHashCodeMethod

public static Method extractHashCodeMethod(Class clazz)
                                    throws NoSuchMethodException
Encapsulation of getting hold of a class's hashCode method.

Parameters:
clazz - The class from which to extract the hashCode method.
Returns:
The hashCode method reference
Throws:
NoSuchMethodException - Should indicate an attempt to extract hashCode method from interface.

overridesEquals

public static boolean overridesEquals(Class clazz)
Determine if the given class defines an Object.equals(java.lang.Object) override.

Parameters:
clazz - The class to check
Returns:
True if clazz defines an equals override.

overridesHashCode

public static boolean overridesHashCode(Class clazz)
Determine if the given class defines a Object.hashCode() override.

Parameters:
clazz - The class to check
Returns:
True if clazz defines an hashCode override.

classForName

public static Class classForName(String name,
                                 Class 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 - The class name
caller - The class from which this call originated (in order to access that class's loader).
Returns:
The class reference.
Throws:
ClassNotFoundException - From Class.forName(String, boolean, ClassLoader).

classForName

public static Class 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 - The class name
Returns:
The class reference.
Throws:
ClassNotFoundException - From Class.forName(String).

isPublic

public static boolean isPublic(Class clazz,
                               Member member)
Is this member publicly accessible.

Parameters:
clazz - The class which defines the member
member - The memeber.
Returns:
True if the member is publicly accessible, false otherwise.

getConstantValue

public static Object getConstantValue(String name)
Resolve a constant to its actual value.

Parameters:
name - The name
Returns:
The value

isAbstractClass

public static boolean isAbstractClass(Class clazz)
Determine if the given class is declared abstract.

Parameters:
clazz - The class to check.
Returns:
True if the class is abstract, false otherwise.

isFinalClass

public static boolean isFinalClass(Class clazz)
Determine is the given class is declared final.

Parameters:
clazz - The class to check.
Returns:
True if the class is final, flase otherwise.

getMethod

public static Method getMethod(Class clazz,
                               Method method)

Hibernate Commons Annotations 3.2.0.Final-redhat-2

Copyright © 2005-2012 JBoss by Red Hat. All Rights Reserved.