public class ReflectionHelper extends Object
Constructor and Description |
---|
ReflectionHelper() |
Modifier and Type | Method and Description |
---|---|
static Object |
getField(Class<?> klass,
Object obj,
String name)
Gets the value of a field.
|
static Class<?> |
loadClass(String klass)
Loads
klass using Class.forName. |
static <T> T |
newInstance(Class<T> klass)
Creates a new instance of
klass . |
static void |
setField(Class<?> klass,
Object obj,
String name,
Object value)
Sets the value of a field.
|
public static Object getField(Class<?> klass, Object obj, String name)
public static <T> T newInstance(Class<T> klass)
klass
. The class must have a no-arg
constructor. The constructor may have any access modifier (for example,
private).Copyright © 2016. All rights reserved.