Package org.yaml.snakeyaml.representer
Class Representer
java.lang.Object
org.yaml.snakeyaml.representer.BaseRepresenter
org.yaml.snakeyaml.representer.SafeRepresenter
org.yaml.snakeyaml.representer.Representer
Represent JavaBeans
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.yaml.snakeyaml.representer.SafeRepresenter
SafeRepresenter.RepresentArray, SafeRepresenter.RepresentBoolean, SafeRepresenter.RepresentByteArray, SafeRepresenter.RepresentDate, SafeRepresenter.RepresentEnum, SafeRepresenter.RepresentIterator, SafeRepresenter.RepresentList, SafeRepresenter.RepresentMap, SafeRepresenter.RepresentNull, SafeRepresenter.RepresentNumber, SafeRepresenter.RepresentPrimitiveArray, SafeRepresenter.RepresentSet, SafeRepresenter.RepresentString, SafeRepresenter.RepresentUuid
-
Field Summary
FieldsFields inherited from class org.yaml.snakeyaml.representer.SafeRepresenter
classTags, nonPrintableStyle, timeZone
Fields inherited from class org.yaml.snakeyaml.representer.BaseRepresenter
defaultFlowStyle, defaultScalarStyle, multiRepresenters, nullRepresenter, objectToRepresent, representedObjects, representers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkGlobalTag
(Property property, Node node, Object object) Remove redundant global tag for a type safe (generic) collection if it is the same as defined by the JavaBean propertygetProperties
(Class<? extends Object> type) Get JavaBean properties to be serialised.protected MappingNode
representJavaBean
(Set<Property> properties, Object javaBean) Tag logic: - explicit root tag is set in serializer - if there is a predefined class tag it is used - a global tag with class name is always used as tag.protected NodeTuple
representJavaBeanProperty
(Object javaBean, Property property, Object propertyValue, Tag customTag) Represent one JavaBean property.private void
void
setPropertyUtils
(PropertyUtils propertyUtils) Methods inherited from class org.yaml.snakeyaml.representer.SafeRepresenter
addClassTag, getTag, getTimeZone, setTimeZone
Methods inherited from class org.yaml.snakeyaml.representer.BaseRepresenter
getDefaultFlowStyle, getDefaultScalarStyle, getPropertyUtils, isExplicitPropertyUtils, represent, representData, representMapping, representScalar, representScalar, representSequence, setDefaultFlowStyle, setDefaultScalarStyle
-
Field Details
-
typeDefinitions
-
-
Constructor Details
-
Representer
public Representer() -
Representer
-
-
Method Details
-
addTypeDescription
-
setPropertyUtils
- Overrides:
setPropertyUtils
in classBaseRepresenter
-
representJavaBean
Tag logic: - explicit root tag is set in serializer - if there is a predefined class tag it is used - a global tag with class name is always used as tag. The JavaBean parent of the specified JavaBean may set another tag (tag:yaml.org,2002:map) when the property class is the same as runtime class- Parameters:
properties
- JavaBean gettersjavaBean
- instance for Node- Returns:
- Node to get serialized
-
representJavaBeanProperty
protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) Represent one JavaBean property.- Parameters:
javaBean
- - the instance to be representedproperty
- - the property of the instancepropertyValue
- - value to be representedcustomTag
- - user defined Tag- Returns:
- NodeTuple to be used in a MappingNode. Return null to skip the property
-
checkGlobalTag
Remove redundant global tag for a type safe (generic) collection if it is the same as defined by the JavaBean property- Parameters:
property
- - JavaBean propertynode
- - representation of the propertyobject
- - instance represented by the node
-
resetTag
-
getProperties
Get JavaBean properties to be serialised. The order is respected. This method may be overridden to provide custom property selection or order.- Parameters:
type
- - JavaBean to inspect the properties- Returns:
- properties to serialise
-