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:
java.lang.Comparable<Property>
public class MethodProperty extends GenericProperty
A
MethodPropertyis aPropertywhich is accessed through accessor methods (setX, getX). It is possible to have aMethodPropertywhich has only setter, only getter, or both. It is not possible to have aMethodPropertywhich has neither setter nor getter.
-
-
Constructor Summary
Constructors Constructor Description MethodProperty(java.beans.PropertyDescriptor property)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static booleanaddPublicFields(java.lang.Class<?> type, java.util.Map<java.lang.String,Property> properties)Introspects giventypeand adds found properties topropertiesmap.private static java.lang.reflect.TypediscoverGenericType(java.beans.PropertyDescriptor property)java.lang.Objectget(java.lang.Object object)<A extends java.lang.annotation.Annotation>
AgetAnnotation(java.lang.Class<A> annotationType)Returns property's annotation for the given type ornullif it's not present.java.util.List<java.lang.annotation.Annotation>getAnnotations()Returns the annotations that are present on read and write methods of this property or emptyListif there're no annotations.booleanisReadable()private static booleanisTransient(java.beans.FeatureDescriptor fd)booleanisWritable()voidset(java.lang.Object object, java.lang.Object value)-
Methods inherited from class org.yaml.snakeyaml.introspector.GenericProperty
getActualTypeArguments
-
-
-
-
Field Detail
-
property
private final java.beans.PropertyDescriptor property
-
readable
private final boolean readable
-
writable
private final boolean writable
-
TRANSIENT
private static final java.lang.String TRANSIENT
- See Also:
- Constant Field Values
-
-
Method Detail
-
discoverGenericType
private static java.lang.reflect.Type discoverGenericType(java.beans.PropertyDescriptor property)
-
set
public void set(java.lang.Object object, java.lang.Object value) throws java.lang.Exception
-
getAnnotations
public java.util.List<java.lang.annotation.Annotation> getAnnotations()
Returns the annotations that are present on read and write methods of this property or emptyListif there're no annotations.- Specified by:
getAnnotationsin classProperty- Returns:
- the annotations that are present on this property or empty
Listif there're no annotations
-
getAnnotation
public <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> annotationType)
Returns property's annotation for the given type ornullif it's not present. If the annotation is present on both read and write methods, the annotation on read method takes precedence.- Specified by:
getAnnotationin 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
nullif it's not present
-
isWritable
public boolean isWritable()
- Overrides:
isWritablein classProperty
-
isReadable
public boolean isReadable()
- Overrides:
isReadablein classProperty
-
isTransient
private static boolean isTransient(java.beans.FeatureDescriptor fd)
-
addPublicFields
static boolean addPublicFields(java.lang.Class<?> type, java.util.Map<java.lang.String,Property> properties)Introspects giventypeand adds found properties topropertiesmap.- Parameters:
type- the type to introspectproperties- map to add found properties to- Returns:
trueif an inaccessible field was found
-
-