Package org.yaml.snakeyaml.introspector
Class MethodProperty
- java.lang.Object
-
- org.yaml.snakeyaml.introspector.Property
-
- org.yaml.snakeyaml.introspector.GenericProperty
-
- org.yaml.snakeyaml.introspector.MethodProperty
-
- All Implemented Interfaces:
Comparable<Property>
public class MethodProperty extends GenericProperty
A
MethodProperty
is aProperty
which is accessed through accessor methods (setX, getX). It is possible to have aMethodProperty
which has only setter, only getter, or both. It is not possible to have aMethodProperty
which has neither setter nor getter.
-
-
Constructor Summary
Constructors Constructor Description MethodProperty(PropertyDescriptor property)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
get(Object object)
<A extends Annotation>
AgetAnnotation(Class<A> annotationType)
Returns property's annotation for the given type ornull
if it's not present.List<Annotation>
getAnnotations()
Returns the annotations that are present on read and write methods of this property or emptyList
if there're no annotations.boolean
isReadable()
boolean
isWritable()
void
set(Object object, Object value)
-
Methods inherited from class org.yaml.snakeyaml.introspector.GenericProperty
getActualTypeArguments
-
-
-
-
Constructor Detail
-
MethodProperty
public MethodProperty(PropertyDescriptor property)
-
-
Method Detail
-
getAnnotations
public List<Annotation> getAnnotations()
Returns the annotations that are present on read and write methods of this property or emptyList
if there're no annotations.- Specified by:
getAnnotations
in classProperty
- Returns:
- the annotations that are present on this property or empty
List
if there're no annotations
-
getAnnotation
public <A extends Annotation> A getAnnotation(Class<A> annotationType)
Returns property's annotation for the given type ornull
if it's not present. If the annotation is present on both read and write methods, the annotation on read method takes precedence.- Specified by:
getAnnotation
in classProperty
- Type Parameters:
A
- class of the annotation- Parameters:
annotationType
- the type of the annotation to be returned- Returns:
- property's annotation for the given type or
null
if it's not present
-
isWritable
public boolean isWritable()
- Overrides:
isWritable
in classProperty
-
isReadable
public boolean isReadable()
- Overrides:
isReadable
in classProperty
-
-