|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.infinispan.util.ReflectionUtil
public class ReflectionUtil
Basic reflection utilities to enhance what the JDK provides.
| Constructor Summary | |
|---|---|
ReflectionUtil()
|
|
| Method Summary | ||
|---|---|---|
static Method |
findGetterForField(Class<?> c,
String fieldName)
|
|
static List<Method> |
getAllMethods(Class c,
Class<? extends Annotation> annotationType)
Returns a set of Methods that contain the given method annotation. |
|
static List<Field> |
getAnnotatedFields(Class<?> c,
Class<? extends Annotation> annotationType)
|
|
static
|
getAnnotation(Class clazz,
Class<T> ann)
Inspects the class passed in for the class level annotation specified. |
|
static List<Field> |
getFields(Class<?> c,
Class<?> type)
|
|
static Object |
getValue(Object instance,
String fieldName)
Retrieves the value of a field of an object instance via reflection |
|
static void |
invokeAccessibly(Object instance,
Method method,
Object[] parameters)
Invokes a method using reflection, in an accessible manner (by using AccessibleObject.setAccessible(boolean) |
|
static boolean |
isAnnotationPresent(Class clazz,
Class<? extends Annotation> annotation)
Tests whether an annotation is present on a class. |
|
static void |
setValue(Object instance,
String fieldName,
Object value)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReflectionUtil()
| Method Detail |
|---|
public static List<Method> getAllMethods(Class c,
Class<? extends Annotation> annotationType)
c - class to inspectannotationType - the type of annotation to look for
public static List<Field> getAnnotatedFields(Class<?> c,
Class<? extends Annotation> annotationType)
public static List<Field> getFields(Class<?> c,
Class<?> type)
public static void setValue(Object instance,
String fieldName,
Object value)
public static void invokeAccessibly(Object instance,
Method method,
Object[] parameters)
AccessibleObject.setAccessible(boolean)
instance - instance on which to execute the methodmethod - method to executeparameters - parameters
public static Method findGetterForField(Class<?> c,
String fieldName)
throws NoSuchMethodException
NoSuchMethodException
public static Object getValue(Object instance,
String fieldName)
instance - to inspectfieldName - name of field to retrieve
public static <T extends Annotation> T getAnnotation(Class clazz,
Class<T> ann)
clazz - class to inspectann - annotation to search for. Must be a class-level annotation.
public static boolean isAnnotationPresent(Class clazz,
Class<? extends Annotation> annotation)
clazz - class to testannotation - annotation to look for
|
Google Analytics | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||