public class PropertyAdapter<V> extends Object implements Property<V>
This class is an adapter that encapsulates a FieldProperty and MethodProperty instance for a
property, giving a single view of a property and its related information independent of the member type: field or
method. The latter usually being a accessor or a mutator method.
This adapter is specially useful when checking for property's metadata independent of the member. This is the case when checking the presence of annotations. As annotations can be defined in one of the members only, if one of the members define the annotation the property itself has the annotation too.
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
AnnotatedElement |
getAnnotatedElement()
Get the element responsible for retrieving the property value
|
Type |
getBaseType()
Returns the property type
|
Class<?> |
getDeclaringClass()
Returns the class that declares the property
|
Class<V> |
getJavaClass()
Returns the property type
|
Member |
getMember()
Get the member responsible for retrieving the property value
|
String |
getName()
Returns the name of the property.
|
V |
getValue(Object instance)
Returns the property value for the specified bean.
|
int |
hashCode() |
boolean |
isAnnotationPresent(Class<? extends Annotation> annotation)
Indicates whether the given
annotation is defined for this property. |
boolean |
isReadOnly()
Indicates whether this is a read-only property
|
void |
setAccessible()
Calls the setAccessible method on the underlying member(s).
|
void |
setValue(Object instance,
V value)
This method sets the property value for a specified bean to the specified value.
|
String |
toString() |
public String getName()
Propertypublic Type getBaseType()
PropertygetBaseType in interface Property<V>public Class<V> getJavaClass()
PropertygetJavaClass in interface Property<V>public AnnotatedElement getAnnotatedElement()
PropertygetAnnotatedElement in interface Property<V>public Member getMember()
Propertypublic V getValue(Object instance)
Propertypublic void setValue(Object instance, V value)
Propertypublic Class<?> getDeclaringClass()
PropertygetDeclaringClass in interface Property<V>public boolean isReadOnly()
PropertyisReadOnly in interface Property<V>public void setAccessible()
PropertyPrivilegedActionsetAccessible in interface Property<V>public boolean isAnnotationPresent(Class<? extends Annotation> annotation)
Propertyannotation is defined for this property. This method will consider
the annotations present in both field and accessor method.isAnnotationPresent in interface Property<V>annotation - The Annotation to check.Copyright © 2016 JBoss by Red Hat. All rights reserved.