|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvoldemort.utils.ReflectUtils
public class ReflectUtils
Utilities for reflection
Constructor Summary | |
---|---|
ReflectUtils()
|
Method Summary | ||
---|---|---|
static
|
callConstructor(java.lang.Class<T> klass)
Call the no-arg constructor for the given class |
|
static
|
callConstructor(java.lang.Class<T> c,
java.lang.Class<?>[] argTypes,
java.lang.Object[] args)
Call the class constructor with the given arguments |
|
static
|
callConstructor(java.lang.Class<T> klass,
java.lang.Object[] args)
Call the constructor for the given class, inferring the correct types for the arguments. |
|
static
|
callMethod(java.lang.Object obj,
java.lang.Class<T> c,
java.lang.String name,
java.lang.Class<?>[] classes,
java.lang.Object[] args)
Call the named method |
|
static
|
getMethod(java.lang.Class<T> c,
java.lang.String name,
java.lang.Class<?>... argTypes)
Get the named method from the class |
|
static java.lang.String |
getPropertyName(java.lang.String name)
Get the property name of a method name. |
|
static java.lang.Class<?> |
loadClass(java.lang.String className)
Load the given class using the default constructor |
|
static java.lang.Class<?> |
loadClass(java.lang.String className,
java.lang.ClassLoader cl)
Load the given class using a specific class loader. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReflectUtils()
Method Detail |
---|
public static java.lang.String getPropertyName(java.lang.String name)
name
- The name to process
public static java.lang.Class<?> loadClass(java.lang.String className)
className
- The name of the class
public static java.lang.Class<?> loadClass(java.lang.String className, java.lang.ClassLoader cl)
className
- The name of the classcl
- The Class Loader to be used for finding the class.
public static <T> T callConstructor(java.lang.Class<T> klass)
T
- The type of the thing to constructklass
- The class
public static <T> T callConstructor(java.lang.Class<T> klass, java.lang.Object[] args)
klass
- The class to constructargs
- The arguments
public static <T> T callConstructor(java.lang.Class<T> c, java.lang.Class<?>[] argTypes, java.lang.Object[] args)
c
- The classargs
- The arguments
public static <T> java.lang.Object callMethod(java.lang.Object obj, java.lang.Class<T> c, java.lang.String name, java.lang.Class<?>[] classes, java.lang.Object[] args)
obj
- The object to call the method onc
- The class of the objectname
- The name of the methodargs
- The method arguments
public static <T> java.lang.reflect.Method getMethod(java.lang.Class<T> c, java.lang.String name, java.lang.Class<?>... argTypes)
c
- The class to get the method fromname
- The method nameargTypes
- The argument types
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |