public class ReflectionUtils extends Object
| Constructor and Description |
|---|
ReflectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkNonStaticField(Class<?> userImplClass,
Class<?> parentClass) |
static void |
cloneWritableInto(Writable dst,
Writable src)
Deprecated.
|
static Field |
findDeclaredField(Class<?> inClass,
String fieldname)
Find a declared field in a class or one of its super classes
|
static Method |
findDeclaredMethod(Class<?> inClass,
String methodName)
Find a declared method in a class
|
static Method |
findDeclaredMethodRecursive(Class<?> inClass,
String methodName)
Find a declared method in a class or one of its super classes
|
static Method |
findUserClassMethod(Class<?> inClass,
String methodName)
Deprecated.
|
static List<Method> |
findUserClassMethods(Class<?> inClass,
String methodName)
Find declared methods in a class by method name
|
static Class<?> |
getClass(Type type)
Get the underlying class for a type, or null if the type is a variable
type.
|
static <T> List<Class<?>> |
getTypeArguments(Class<T> baseClass,
Class<? extends T> childClass)
Get the actual type arguments a child class has used to extend a generic
base class.
|
static <T> T |
newInstance(Class<T> theClass,
Configuration conf)
Create an object for the given class and initialize it from conf
|
static <T> T |
newInstanceFast(Class<T> theClass,
Configuration configuration)
Instantiate classes that are ImmmutableClasssesGiraphConfigurable
|
static void |
setConf(Object theObject,
Configuration conf)
Check and set 'configuration' if necessary.
|
static void |
setField(Object target,
String fieldname,
Object value)
Try to directly set a (possibly private) field on an Object.
|
public static void setConf(Object theObject, Configuration conf)
theObject - object for which to set configurationconf - Configurationpublic static <T> T newInstance(Class<T> theClass, Configuration conf)
theClass - class of which an object is createdconf - Configurationpublic static <T> T newInstanceFast(Class<T> theClass, Configuration configuration)
T - Type to instantiatetheClass - Class to instantiateconfiguration - Graph configuration, may be null@Deprecated public static Method findUserClassMethod(Class<?> inClass, String methodName)
inClass - Class to search for declared field.methodName - Method name to search forpublic static List<Method> findUserClassMethods(Class<?> inClass, String methodName)
inClass - Class to search for declared field.methodName - Method name to search forpublic static Class<?> getClass(Type type)
type - the typepublic static void setField(Object target, String fieldname, Object value) throws NoSuchFieldException, IllegalAccessException
target - Target to set the field on.fieldname - Name of field.value - Value to set on target.NoSuchFieldExceptionIllegalAccessExceptionpublic static Field findDeclaredField(Class<?> inClass, String fieldname) throws NoSuchFieldException
inClass - Class to search for declared field.fieldname - Field name to search forNoSuchFieldException - When field not found.public static Method findDeclaredMethodRecursive(Class<?> inClass, String methodName) throws NoSuchMethodException
inClass - Class to search for declared field.methodName - Method name to search forNoSuchMethodException - When method not found.public static Method findDeclaredMethod(Class<?> inClass, String methodName)
inClass - Class to search for declared field.methodName - Method name to search forNoSuchMethodException - When method not found.public static <T> List<Class<?>> getTypeArguments(Class<T> baseClass, Class<? extends T> childClass)
T - Type to evaluate.baseClass - the base classchildClass - the child classpublic static void checkNonStaticField(Class<?> userImplClass, Class<?> parentClass)
@Deprecated public static void cloneWritableInto(Writable dst, Writable src) throws IOException
IOExceptionCopyright © 2024 Alibaba Cloud Computing. All rights reserved.