Class BaseRepresenter
java.lang.Object
org.snakeyaml.engine.v2.representer.BaseRepresenter
- Direct Known Subclasses:
StandardRepresenter
Represent basic YAML structures: scalar, sequence, mapping
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FlowStyle
flow style for collectionsprotected ScalarStyle
scalar styleprotected RepresentToNode
in Java 'null' is not a type.protected Object
the current object to be converted to Nodeprotected final Map
<Class<?>, RepresentToNode> Keep representers which match a parent of the class to be representedKeep references of already represented instances.protected final Map
<Class<?>, RepresentToNode> Keep representers which must match the class exactly -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Optional
<RepresentToNode> findRepresenterFor
(Object data) Find the representer which is suitable to represent the internal structure of the provided instance to a NodeRepresent the provided Java instance to a Nodeprotected final Node
representData
(Object data) Find the representer and use it to create the Node from instanceprotected Node
representMapping
(Tag tag, Map<?, ?> mapping, FlowStyle flowStyle) Create Node for the provided Mapprotected NodeTuple
representMappingEntry
(Map.Entry<?, ?> entry) Create a tuple for one key pairprotected Node
representScalar
(Tag tag, String value) Create Node for string using PLAIN scalar style if possibleprotected Node
representScalar
(Tag tag, String value, ScalarStyle style) Create Scalar Node from stringprotected Node
representSequence
(Tag tag, Iterable<?> sequence, FlowStyle flowStyle) Create Node
-
Field Details
-
representers
Keep representers which must match the class exactly -
parentClassRepresenters
Keep representers which match a parent of the class to be represented -
representedObjects
Keep references of already represented instances. The order is important (map can be also a sequence of key-values) -
nullRepresenter
in Java 'null' is not a type. So we have to keep the null representer separately -
defaultScalarStyle
scalar style -
defaultFlowStyle
flow style for collections -
objectToRepresent
the current object to be converted to Node
-
-
Constructor Details
-
BaseRepresenter
public BaseRepresenter()
-
-
Method Details
-
represent
Represent the provided Java instance to a Node- Parameters:
data
- - Java instance to be represented- Returns:
- The Node to be serialized
-
findRepresenterFor
Find the representer which is suitable to represent the internal structure of the provided instance to a Node- Parameters:
data
- - the data to be serialized- Returns:
- RepresentToNode to call to create a Node
-
representData
Find the representer and use it to create the Node from instance- Parameters:
data
- - the source- Returns:
- Node for the provided source
-
representScalar
Create Scalar Node from string- Parameters:
tag
- - the tag in Nodevalue
- - the sourcestyle
- - the style- Returns:
- Node for string
-
representScalar
Create Node for string using PLAIN scalar style if possible- Parameters:
tag
- - the tag for Nodevalue
- - the surce- Returns:
- Node for string
-
representSequence
Create Node- Parameters:
tag
- - tag to use in Nodesequence
- - the sourceflowStyle
- - the flow style- Returns:
- the Node from the source iterable
-
representMappingEntry
Create a tuple for one key pair- Parameters:
entry
- - Map entry- Returns:
- the tuple where both key and value are converted to Node
-
representMapping
Create Node for the provided Map- Parameters:
tag
- - the tag for Nodemapping
- - the sourceflowStyle
- - the style of Node- Returns:
- Node for the source Map
-