|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vaadin.tools.ReflectTools
public class ReflectTools
An util class with helpers for reflection operations. Used internally by Vaadin and should not be used by application developers. Subject to change at any time.
Constructor Summary | |
---|---|
ReflectTools()
|
Method Summary | |
---|---|
static Method |
findMethod(Class<?> cls,
String methodName,
Class<?>... parameterTypes)
Locates the method in the given class. |
static Object |
getJavaFieldValue(Object object,
Field field)
Returns the value of the java field. |
static void |
setJavaFieldValue(Object object,
Field field,
Object value)
Sets the value of a java field. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReflectTools()
Method Detail |
---|
public static Method findMethod(Class<?> cls, String methodName, Class<?>... parameterTypes) throws ExceptionInInitializerError
cls
- Class that contains the methodmethodName
- The name of the methodparameterTypes
- The parameter types for the method.
ExceptionInInitializerError
- Wraps any exception in an ExceptionInInitializerError
so this method can be called from a static initializer.public static Object getJavaFieldValue(Object object, Field field) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
Uses getter if present, otherwise tries to access even private fields directly.
object
- The object containing the fieldfield
- The field we want to get the value for
InvocationTargetException
- If the value could not be retrieved
IllegalAccessException
- If the value could not be retrieved
IllegalArgumentException
- If the value could not be retrievedpublic static void setJavaFieldValue(Object object, Field field, Object value) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
Uses setter if present, otherwise tries to access even private fields directly.
object
- The object containing the fieldfield
- The field we want to set the value forvalue
- The value to set
IllegalAccessException
- If the value could not be assigned to the field
IllegalArgumentException
- If the value could not be assigned to the field
InvocationTargetException
- If the value could not be assigned to the field
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |