Package io.beanmapper.core.inspector
Class MethodPropertyAccessor
java.lang.Object
io.beanmapper.core.inspector.MethodPropertyAccessor
- All Implemented Interfaces:
PropertyAccessor
Property descriptor implementation of property accessor.
- Since:
- Jun 24, 2015
- Author:
- Jeroen van Schagen
-
Constructor Summary
-
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.
-
Constructor Details
-
MethodPropertyAccessor
-
-
Method Details
-
getName
Retrieve the property name.- Specified by:
getName
in interfacePropertyAccessor
- Returns:
- property name
-
getType
Retrieve the property type.- Specified by:
getType
in interfacePropertyAccessor
- Returns:
- property type
-
findAnnotation
Retrieve the annotation on a property.- Specified by:
findAnnotation
in interfacePropertyAccessor
- Type Parameters:
A
- class type of the annotation class- Parameters:
annotationClass
- annotation class- Returns:
- the annotation, if any
-
isReadable
public boolean isReadable()Determine if the property is readable.- Specified by:
isReadable
in interfacePropertyAccessor
- Returns:
true
when readable, elsefalse
-
getValue
Retrieve the property value.- Specified by:
getValue
in interfacePropertyAccessor
- Parameters:
instance
- bean that contains the property- Returns:
- the property value
-
isWritable
public boolean isWritable()Determine if the property is writable.- Specified by:
isWritable
in interfacePropertyAccessor
- Returns:
true
when writable, elsefalse
-
setValue
Modify the property value.- Specified by:
setValue
in interfacePropertyAccessor
- Parameters:
instance
- bean that contains the propertyvalue
- the new property value
-
getReadMethod
- Specified by:
getReadMethod
in interfacePropertyAccessor
-
getWriteMethod
- Specified by:
getWriteMethod
in interfacePropertyAccessor
-
isAnnotationPresent
Checks whether the given annotation is present on a property.- Specified by:
isAnnotationPresent
in interfacePropertyAccessor
- Type Parameters:
A
- The type of the annotation.- Parameters:
annotationClass
- Annotation-class- Returns:
- True, if the annotation is present on the property, false otherwise.
-
getDeclaringClass
Gets the class that declares the field/method this accessor applies to.- Specified by:
getDeclaringClass
in interfacePropertyAccessor
- Type Parameters:
S
- The type of the declaring class.- Returns:
- The decalring class.
-