org.oddjob.arooa.utils
Class ClassUtils

java.lang.Object
  extended by org.oddjob.arooa.utils.ClassUtils

public class ClassUtils
extends Object

Various utility methods relating to class.

Author:
Rob Gordon.

Constructor Summary
ClassUtils()
           
 
Method Summary
static Class<?> classFor(String className, ClassLoader loader)
          Same as Class.forName exception logs the class loader stack before crashing.
static Object instantiate(String className, ClassLoader loader)
          Instantiates a Class but converts the exception if it fails.
static Class<?> primiativeTypeForWrapper(Class<?> wrapperType)
          Provide the primiative type for a wrapper class.
static Class<?> wrapperClassForPrimitive(Class<?> primitiveType)
          Provide the wrapper class for a primitive type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassUtils

public ClassUtils()
Method Detail

wrapperClassForPrimitive

public static Class<?> wrapperClassForPrimitive(Class<?> primitiveType)
Provide the wrapper class for a primitive type.

Parameters:
primitiveType -
Returns:
The wrapper class or null if the provided class is not a primitive type.

primiativeTypeForWrapper

public static Class<?> primiativeTypeForWrapper(Class<?> wrapperType)
Provide the primiative type for a wrapper class.

Parameters:
wrapperType -
Returns:
The primitive type or null if the provided class is not a wrapper class.

classFor

public static Class<?> classFor(String className,
                                ClassLoader loader)
                         throws ClassNotFoundException
Same as Class.forName exception logs the class loader stack before crashing.

Parameters:
className -
loader -
Returns:
Throws:
ClassNotFoundException

instantiate

public static Object instantiate(String className,
                                 ClassLoader loader)
                          throws ArooaException
Instantiates a Class but converts the exception if it fails.

Parameters:
className -
loader -
Returns:
Throws:
ArooaException