org.apache.jackrabbit.ocm.reflection
Class ReflectionUtils

java.lang.Object
  extended by org.apache.jackrabbit.ocm.reflection.ReflectionUtils

public abstract class ReflectionUtils
extends Object

Utility class for handling reflection using BeanUtils.

Author:
Alexandru Popescu

Constructor Summary
ReflectionUtils()
           
 
Method Summary
static Class forName(String clazz)
           
static Class getBeanClass(Object bean)
           
static ClassLoader getClassLoader()
          Returns the class loader which is used by the forName(String) method to load classes.
static Object getNestedProperty(Object object, String fieldName)
           
static Class getPropertyType(Object object, String fieldName)
           
static Object invokeConstructor(String className, Object[] params)
           
static boolean isProxy(Class beanClass)
           
static Object newInstance(Class clazz)
           
static Object newInstance(String clazz)
           
static void setClassLoader(ClassLoader newClassLoader)
          Sets the class loader to use in the forName(String) method to load classes.
static void setNestedProperty(Object object, String fieldName, Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionUtils

public ReflectionUtils()
Method Detail

setClassLoader

public static void setClassLoader(ClassLoader newClassLoader)
Sets the class loader to use in the forName(String) method to load classes.

Care must be taken when using this method as when setting an improperly set up classloader, the mapper will not work again throwing tons of exceptions.

Parameters:
newClassLoader - The new class loader to use. This may be null in which case the system class loader will be used.

getClassLoader

public static ClassLoader getClassLoader()
Returns the class loader which is used by the forName(String) method to load classes.

Returns:
The class loader used by forName(String) or null if the system class loader is used.

getNestedProperty

public static Object getNestedProperty(Object object,
                                       String fieldName)

getPropertyType

public static Class getPropertyType(Object object,
                                    String fieldName)

newInstance

public static Object newInstance(Class clazz)

invokeConstructor

public static Object invokeConstructor(String className,
                                       Object[] params)
Parameters:
className -
objects -
Returns:

setNestedProperty

public static void setNestedProperty(Object object,
                                     String fieldName,
                                     Object value)
Parameters:
object -
fieldName -
path -

newInstance

public static Object newInstance(String clazz)
Parameters:
string -
Returns:

forName

public static Class forName(String clazz)
Parameters:
elementClassName -
Returns:

isProxy

public static boolean isProxy(Class beanClass)

getBeanClass

public static Class getBeanClass(Object bean)


Copyright © 2004-2008 Apache Software Foundation. All Rights Reserved.