Package io.beanmapper.core.inspector
Interface PropertyAccessor
- All Known Implementing Classes:
CombinedPropertyAccessor
,FieldPropertyAccessor
,MethodPropertyAccessor
public interface PropertyAccessor
Abstraction over accessing properties.
- Since:
- Jun 23, 2015
- Author:
- Jeroen van Schagen
-
Method Summary
Modifier and TypeMethodDescription<A extends Annotation>
AfindAnnotation
(Class<A> annotationClass) Retrieve the annotation on a property.<S> Class<S>
Gets the class that declares the field/method this accessor applies to.getName()
Retrieve the property name.Class<?>
getType()
Retrieve the property type.Retrieve the property value.<A extends Annotation>
booleanisAnnotationPresent
(Class<A> annotationClass) Checks whether the given annotation is present on a property.boolean
Determine if the property is readable.boolean
Determine if the property is writable.void
Modify the property value.
-
Method Details
-
getName
String getName()Retrieve the property name.- Returns:
- property name
-
getType
Class<?> getType()Retrieve the property type.- Returns:
- property type
-
findAnnotation
Retrieve the annotation on a property.- Type Parameters:
A
- class type of the annotation class- Parameters:
annotationClass
- annotation class- Returns:
- the annotation, if any
-
isAnnotationPresent
Checks whether the given annotation is present on a property.- Type Parameters:
A
- The type of the annotation.- Parameters:
annotationClass
- Annotation-class- Returns:
- True, if the annotation is present on the property, false otherwise.
-
isReadable
boolean isReadable()Determine if the property is readable.- Returns:
true
when readable, elsefalse
-
getValue
Retrieve the property value.- Parameters:
instance
- bean that contains the property- Returns:
- the property value
-
isWritable
boolean isWritable()Determine if the property is writable.- Returns:
true
when writable, elsefalse
-
setValue
Modify the property value.- Parameters:
instance
- bean that contains the propertyvalue
- the new property value
-
getReadMethod
Method getReadMethod() -
getWriteMethod
Method getWriteMethod() -
getDeclaringClass
Gets the class that declares the field/method this accessor applies to.- Type Parameters:
S
- The type of the declaring class.- Returns:
- The decalring class.
-