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:
-
Method Summary
Modifier and TypeMethodDescriptionGet the element responsible for retrieving the property valueReturns the property typeClass<?>
Returns the class that declares the propertyReturns the property typeGet the member responsible for retrieving the property valuegetName()
Returns the name of the property.Returns the property value for the specified bean.boolean
isAnnotationPresent
(Class<? extends Annotation> annotation) Indicates whether the givenannotation
is defined for this property.boolean
Indicates whether this is a read-only propertyvoid
Calls the setAccessible method on the underlying member(s).void
This method sets the property value for a specified bean to the specified value.
-
Method Details
-
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
-
getJavaClass
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
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
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
Indicates whether the givenannotation
is 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.
-