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()
Property
public Type getBaseType()
Property
getBaseType
in interface Property<V>
public Class<V> getJavaClass()
Property
getJavaClass
in interface Property<V>
public AnnotatedElement getAnnotatedElement()
Property
getAnnotatedElement
in interface Property<V>
public Member getMember()
Property
public V getValue(Object instance)
Property
public void setValue(Object instance, V value)
Property
public Class<?> getDeclaringClass()
Property
getDeclaringClass
in interface Property<V>
public boolean isReadOnly()
Property
isReadOnly
in interface Property<V>
public void setAccessible()
Property
PrivilegedAction
setAccessible
in interface Property<V>
public boolean isAnnotationPresent(Class<? extends Annotation> annotation)
Property
annotation
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 © 2017 JBoss by Red Hat. All rights reserved.