|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xwiki.component.util.ReflectionUtils
public final class ReflectionUtils
Various Reflection utilities.
| Method Summary | |
|---|---|
static Collection<Field> |
getAllFields(Class<?> componentClass)
|
static Class<?> |
getLastGenericClassType(Class clazz,
Class filterClass)
Extract the last generic type from the passed class. |
static Class<?> |
getLastGenericFieldType(Field field)
Extract the last generic type from the passed field. |
static void |
setFieldValue(Object instanceContainingField,
String fieldName,
Object fieldValue)
Sets a value to a field using reflection even if the field is private. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Collection<Field> getAllFields(Class<?> componentClass)
componentClass - the class for which to return all fields
public static void setFieldValue(Object instanceContainingField,
String fieldName,
Object fieldValue)
instanceContainingField - the object containing the fieldfieldName - the name of the field in the objectfieldValue - the value to set for the provided fieldpublic static Class<?> getLastGenericFieldType(Field field)
private List<A, B> field
would return the B class.
field - the field from which to extract the generic type
public static Class<?> getLastGenericClassType(Class clazz,
Class filterClass)
public Class MyClass implements FilterClass<A, B>, SomeOtherClass<C> will return B.
clazz - the class to extract fromfilterClass - the class of the generic type we're looking for
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||