Top Description Inners Fields Constructors Methods
org.yaml.snakeyaml.representer

public Class Representer

extends SafeRepresenter
Class Inheritance
Imports
java.util.ArrayList, .Arrays, .Collection, .Collections, .HashMap, .Iterator, .List, .Map, .Set, org.yaml.snakeyaml.DumperOptions, .DumperOptions.FlowStyle, .TypeDescription, org.yaml.snakeyaml.introspector.Property, .PropertyUtils, org.yaml.snakeyaml.nodes.MappingNode, .Node, .NodeId, .NodeTuple, .ScalarNode, .SequenceNode, .Tag

Represent JavaBeans

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class

Field Summary

Modifier and TypeField and Description
protected Map<Class<? extends Object>, TypeDescription>
Inherited from org.yaml.snakeyaml.representer.SafeRepresenter:
classTagsnonPrintableStyletimeZone

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public TypeDescription
protected void
checkGlobalTag(Property
- JavaBean property
property
,
Node
- representation of the property
node
,
Object
- instance represented by the node
object
)

Remove redundant global tag for a type safe (generic) collection if it is the same as defined by the JavaBean property

protected Set<Property>

Returns:

properties to serialise
getProperties
(Class<? extends Object>
- JavaBean to inspect the properties
type
)

Get JavaBean properties to be serialised.

protected MappingNode

Returns:

Node to get serialized
representJavaBean
(Set<Property>
JavaBean getters
properties
,
Object
instance for Node
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

Returns:

NodeTuple to be used in a MappingNode. Return null to skip the property
representJavaBeanProperty
(Object
- the instance to be represented
javaBean
,
Property
- the property of the instance
property
,
Object
- value to be represented
propertyValue
,
Tag
- user defined Tag
customTag
)

Represent one JavaBean property.

private void
resetTag(Class<? extends Object> type, Node node)

public void
Inherited from org.yaml.snakeyaml.representer.SafeRepresenter:
addClassTaggetTaggetTimeZonesetTimeZone

Field Detail

typeDefinitionsback to summary
protected Map<Class<? extends Object>, TypeDescription> typeDefinitions

Constructor Detail

Representerback to summary
public Representer(DumperOptions options)

Method Detail

addTypeDescriptionback to summary
public TypeDescription addTypeDescription(TypeDescription td)
checkGlobalTagback to summary
protected 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 property

Parameters
property:Property

- JavaBean property

node:Node

- representation of the property

object:Object

- instance represented by the node

Annotations
@SuppressWarnings:unchecked
getPropertiesback to summary
protected Set<Property> getProperties(Class<? extends Object> type)

Get JavaBean properties to be serialised. The order is respected. This method may be overridden to provide custom property selection or order.

Parameters
type:Class<? extends Object>

- JavaBean to inspect the properties

Returns:Set<Property>

properties to serialise

representJavaBeanback to summary
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. 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:Set<Property>

JavaBean getters

javaBean:Object

instance for Node

Returns:MappingNode

Node to get serialized

representJavaBeanPropertyback to summary
protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag)

Represent one JavaBean property.

Parameters
javaBean:Object

- the instance to be represented

property:Property

- the property of the instance

propertyValue:Object

- value to be represented

customTag:Tag

- user defined Tag

Returns:NodeTuple

NodeTuple to be used in a MappingNode. Return null to skip the property

resetTagback to summary
private void resetTag(Class<? extends Object> type, Node node)
setPropertyUtilsback to summary
public void setPropertyUtils(PropertyUtils propertyUtils)

Overrides org.yaml.snakeyaml.representer.BaseRepresenter.setPropertyUtils.

Annotations
@Override
org.yaml.snakeyaml.representer back to summary

protected Class Representer.RepresentJavaBean

extends Object
implements Represent
Class Inheritance
All Implemented Interfaces
org.yaml.snakeyaml.representer.Represent

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public Node
representData(Object
the instance to represent
data
)

Implements org.yaml.snakeyaml.representer.Represent.representData.

Create a Node
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

RepresentJavaBeanback to summary
protected RepresentJavaBean()

Method Detail

representDataback to summary
public Node representData(Object data)

Implements org.yaml.snakeyaml.representer.Represent.representData.

Doc from org.yaml.snakeyaml.representer.Represent.representData.

Create a Node

Parameters
data:Object

the instance to represent

Returns:Node

Node to dump