Interface Property<V>
-
- Type Parameters:
V- the type of the properties value
- All Known Subinterfaces:
MethodProperty<V>
public interface Property<V>A representation of a JavaBean style property- See Also:
Properties
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AnnotatedElementgetAnnotatedElement()Get the element responsible for retrieving the property valueTypegetBaseType()Returns the property typeClass<?>getDeclaringClass()Returns the class that declares the propertyClass<V>getJavaClass()Returns the property typeMembergetMember()Get the member responsible for retrieving the property valueStringgetName()Returns the name of the property.VgetValue(Object instance)Returns the property value for the specified bean.booleanisAnnotationPresent(Class<? extends Annotation> annotation)Indicates whether the givenannotationis defined for this property.booleanisReadOnly()Indicates whether this is a read-only propertyvoidsetAccessible()Calls the setAccessible method on the underlying member(s).voidsetValue(Object instance, V value)This method sets the property value for a specified bean to the specified value.
-
-
-
Method Detail
-
getName
String getName()
Returns the name of the property. If the property is a field, then the field name is returned. Otherwise, if the property is a method, then the name that is returned is the getter method name without the "get" or "is" prefix, and a lower case first letter.- Returns:
- The name of the property
-
getBaseType
Type getBaseType()
Returns the property type- Returns:
- The property type
-
getAnnotatedElement
AnnotatedElement getAnnotatedElement()
Get the element responsible for retrieving the property value- Returns:
-
getMember
Member getMember()
Get the member responsible for retrieving the property value- Returns:
-
getValue
V getValue(Object instance)
Returns the property value for the specified bean. The property to be returned is either a field or getter method.- Parameters:
bean- The bean to read the property from- Returns:
- The property value
- Throws:
ClassCastException- if the value is not of the type V
-
setValue
void setValue(Object instance, V value)
This method sets the property value for a specified bean to the specified value. The property to be set is either a field or setter method.- Parameters:
bean- The bean containing the property to setvalue- The new property value
-
getDeclaringClass
Class<?> getDeclaringClass()
Returns the class that declares the property- Returns:
-
isReadOnly
boolean isReadOnly()
Indicates whether this is a read-only property- Returns:
-
setAccessible
void setAccessible()
Calls the setAccessible method on the underlying member(s). The operation should be performed within aPrivilegedAction
-
isAnnotationPresent
boolean isAnnotationPresent(Class<? extends Annotation> annotation)
Indicates whether the givenannotationis defined for this property. This method will consider the annotations present in both field and accessor method.- Parameters:
annotation- The Annotation to check.- Returns:
- True if the annotation is defined. Otherwise is false.
-
-