org.hibersap.mapping
Class ReflectionHelper

java.lang.Object
  extended by org.hibersap.mapping.ReflectionHelper

public class ReflectionHelper
extends java.lang.Object

Author:
Carsten Erker

Method Summary
static java.lang.Class<?> getArrayType(java.lang.Class<?> type)
          Get the array type of type, or null if type is not an array.
static java.lang.Class<?> getClassForName(java.lang.String className)
           
static java.lang.reflect.Field getDeclaredField(java.lang.Object bean, java.lang.String fieldName)
           
static java.lang.Object getFieldValue(java.lang.Object bean, java.lang.String fieldName)
           
static java.lang.Class<?> getGenericType(java.lang.reflect.Field field)
          Get the actual type of a one-dimensional generic field.
static java.util.Collection<java.lang.Object> newCollectionInstance(java.lang.Class<? extends java.util.Collection> clazz)
           
static java.lang.Object newInstance(java.lang.Class<?> clazz)
           
static void setFieldValue(java.lang.Object bean, java.lang.String fieldName, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getClassForName

public static java.lang.Class<?> getClassForName(java.lang.String className)
                                          throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

getArrayType

public static java.lang.Class<?> getArrayType(java.lang.Class<?> type)
Get the array type of type, or null if type is not an array.

Parameters:
type -
Returns:

getDeclaredField

public static java.lang.reflect.Field getDeclaredField(java.lang.Object bean,
                                                       java.lang.String fieldName)

getFieldValue

public static java.lang.Object getFieldValue(java.lang.Object bean,
                                             java.lang.String fieldName)

getGenericType

public static java.lang.Class<?> getGenericType(java.lang.reflect.Field field)
Get the actual type of a one-dimensional generic field.

Parameters:
field -
Returns:

newCollectionInstance

public static java.util.Collection<java.lang.Object> newCollectionInstance(java.lang.Class<? extends java.util.Collection> clazz)

newInstance

public static java.lang.Object newInstance(java.lang.Class<?> clazz)

setFieldValue

public static void setFieldValue(java.lang.Object bean,
                                 java.lang.String fieldName,
                                 java.lang.Object value)


Copyright © 2009 Akquinet Tech@Spree GmbH. All Rights Reserved.