public class PropertyInfo extends AccessibleObject implements Member
It consist of a getter and/or setter Method and can be easily created by TypeExtensions.getProperty(Class, String, BindingFlags).
| Constructor and Description |
|---|
PropertyInfo(String name,
int modifiers,
Class<?> declaringType,
Method getter,
Method setter)
Creates a initializes a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
<T extends Annotation> |
getAnnotation(Class<T> annotationClass) |
<T extends Annotation> |
getAnnotationsByType(Class<T> annotationClass) |
Annotation[] |
getDeclaredAnnotations() |
Class<?> |
getDeclaringClass() |
Method |
getGetter()
Returns the getter method of this property.
|
int |
getModifiers() |
String |
getName() |
Method |
getSetter()
Returns the setter method of this property.
|
Type |
getType()
Returns the type of the property.
|
Object |
getValue(Object instance)
|
int |
hashCode() |
boolean |
isReadable()
Returns whether this property has a getter and is therefore readable.
|
boolean |
isSynthetic() |
boolean |
isWriteable()
Returns whether this property has a setter and is therefore writeable.
|
void |
setValue(Object instance,
Object value)
|
getAnnotations, getDeclaredAnnotation, getDeclaredAnnotationsByType, isAccessible, isAnnotationPresent, setAccessible, setAccessiblepublic PropertyInfo(String name, int modifiers, Class<?> declaringType, Method getter, Method setter)
name - The simple name of the property.modifiers - The modifiers as defined in Modifier.declaringType - The type declaring this property.getter - The getter method.setter - The setter method.public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
getAnnotation in interface AnnotatedElementgetAnnotation in class AccessibleObjectpublic <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass)
getAnnotationsByType in interface AnnotatedElementgetAnnotationsByType in class AccessibleObjectpublic Annotation[] getDeclaredAnnotations()
getDeclaredAnnotations in interface AnnotatedElementgetDeclaredAnnotations in class AccessibleObjectpublic Class<?> getDeclaringClass()
getDeclaringClass in interface Memberpublic Method getGetter()
public int getModifiers()
getModifiers in interface Memberpublic Method getSetter()
public Type getType()
If there is a Getter, its generic return type is used.
Otherwise the parameterized type of the first parameter of the Setter
is returned.
public Object getValue(Object instance) throws InvocationTargetException, IllegalAccessException
InvocationTargetException - If the underlying method throws an exception.IllegalAccessException - If the underlying method is inaccessible.instance - The instance to get the value from.public boolean isReadable()
public boolean isSynthetic()
isSynthetic in interface Memberpublic boolean isWriteable()
public void setValue(Object instance, Object value) throws InvocationTargetException, IllegalAccessException
InvocationTargetException - If the underlying method throws an exception.IllegalAccessException - If the underlying method is inaccessible.instance - The instance to set the value on.value - The value to set.