public final class ReflectionUtils extends Object
| Constructor and Description |
|---|
ReflectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static List<String> |
getFieldNames(Class<?> cls)
Gets all fieldnames from the given class as an String array.
|
static String[] |
getMethodNames(Class<?> cls)
Gets all methodnames from the given class as an String array.
|
static Map<String,String> |
getMethodNamesWithPrefixFromFieldNames(List<String> fieldNames,
String prefix)
Generates a Map with the fieldName as key and the method as value.
|
static List<String> |
getModifiers(Field field)
Gets the modifiers from the given Field as a list of String objects.
|
static Object |
getNewInstance(Object obj)
Creates a new instance from the same type as the given object.
|
static <T> T |
newInstance(Class<T> clazz)
Creates a new instance from the same type as the given Class.
|
static <T> T |
newInstance(T obj)
Creates a new instance from the same type as the given object.
|
public static List<String> getFieldNames(Class<?> cls)
cls - The class object to get the fieldnames.public static String[] getMethodNames(Class<?> cls)
cls - The class object to get the methodnames.public static final Map<String,String> getMethodNamesWithPrefixFromFieldNames(List<String> fieldNames, String prefix)
fieldNames - A list with the fieldNames.prefix - The prefix for the methodname.public static List<String> getModifiers(Field field)
field - The field to get the modifiers.public static Object getNewInstance(Object obj) throws ClassNotFoundException, InstantiationException, IllegalAccessException
obj - the objClassNotFoundException - the class not found exceptionInstantiationException - the instantiation exceptionIllegalAccessException - the illegal access exceptionpublic static <T> T newInstance(Class<T> clazz) throws InstantiationException, IllegalAccessException, ClassNotFoundException
T - the generic typeclazz - the Class objectClassNotFoundException - the class not found exceptionInstantiationException - the instantiation exceptionIllegalAccessException - the illegal access exceptionpublic static <T> T newInstance(T obj)
throws InstantiationException,
IllegalAccessException,
ClassNotFoundException
T - the generic typeobj - the objClassNotFoundException - the class not found exceptionInstantiationException - the instantiation exceptionIllegalAccessException - the illegal access exceptionCopyright © 2007–2015 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.