public class ReflectionUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static Class<?>[] |
EMPTY_CLASS_ARRAY |
static Object[] |
EMPTY_OBJECT_ARRAY |
| Constructor and Description |
|---|
ReflectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends Persistent> |
classBuilder(Class<T> clazz) |
static <T> Constructor<T> |
getConstructor(Class<T> clazz)
Returns the empty argument constructor of the class.
|
static Object |
getStaticField(Class<?> clazz,
String fieldName)
Returns the value of a named static field
|
static boolean |
hasConstructor(Class<?> clazz)
Returns whether the class defines an empty argument constructor.
|
static <T> T |
newInstance(Class<T> clazz)
Constructs a new instance of the class using the no-arg constructor.
|
static Object |
newInstance(String classStr)
Constructs a new instance of the class using the no-arg constructor.
|
public static Class<?>[] EMPTY_CLASS_ARRAY
public static Object[] EMPTY_OBJECT_ARRAY
public static <T> Constructor<T> getConstructor(Class<T> clazz) throws SecurityException, NoSuchMethodException
public static boolean hasConstructor(Class<?> clazz) throws SecurityException, NoSuchMethodException
public static <T> T newInstance(Class<T> clazz) throws InstantiationException, IllegalAccessException, SecurityException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException
clazz - the class of the objectInstantiationExceptionIllegalAccessExceptionSecurityExceptionNoSuchMethodExceptionIllegalArgumentExceptionInvocationTargetExceptionpublic static Object newInstance(String classStr) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SecurityException, IllegalArgumentException, NoSuchMethodException, InvocationTargetException
classStr - the class name of the objectInstantiationExceptionIllegalAccessExceptionClassNotFoundExceptionSecurityExceptionIllegalArgumentExceptionNoSuchMethodExceptionInvocationTargetExceptionpublic static Object getStaticField(Class<?> clazz, String fieldName) throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException
public static <T extends Persistent> org.apache.avro.specific.SpecificRecordBuilderBase<T> classBuilder(Class<T> clazz) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException
Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.