org.hibersap.mapping
Class ReflectionHelper
java.lang.Object
org.hibersap.mapping.ReflectionHelper
public final class ReflectionHelper
- extends Object
- Author:
- Carsten Erker
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getClassForName
public static Class<?> getClassForName(String className)
throws ClassNotFoundException
- Throws:
ClassNotFoundException
getArrayType
public static Class<?> getArrayType(Class<?> type)
- Get the array type of type, or null if type is not an array.
- Parameters:
type
- The array class type.
- Returns:
- The type of the array components.
getDeclaredField
public static Field getDeclaredField(Object bean,
String fieldName)
getFieldValue
public static Object getFieldValue(Object bean,
String fieldName)
getGenericType
public static Class<?> getGenericType(Field field)
- Get the actual type of a one-dimensional generic field.
- Parameters:
field
- The field
- Returns:
- The generic type or null if the field is not generic
newCollectionInstance
public static Collection<Object> newCollectionInstance(Class<? extends Collection> clazz)
newInstance
public static <T> T newInstance(Class<T> clazz)
newInstance
public static <T> T newInstance(String fullyQualifiedClassName,
Class<T> superType)
createInstances
public static <T> List<T> createInstances(List<String> fullyQualifiedClassNames,
Class<T> superType)
setFieldValue
public static void setFieldValue(Object bean,
String fieldName,
Object value)
getDeclaredFieldsWithAnnotationRecursively
public static Set<Field> getDeclaredFieldsWithAnnotationRecursively(Class<?> clazz,
Class<? extends Annotation> annotationClass)
newArrayFromCollection
public static <T> T[] newArrayFromCollection(Collection<?> collection,
Class<T> elementType)
Copyright © 2012 akquinet tech@spree GmbH. All Rights Reserved.