Class BaseRepresenter
- java.lang.Object
-
- org.snakeyaml.engine.v2.representer.BaseRepresenter
-
- Direct Known Subclasses:
StandardRepresenter
public abstract class BaseRepresenter extends Object
Represent basic YAML structures: scalar, sequence, mapping
-
-
Field Summary
Fields Modifier and Type Field Description protected FlowStyledefaultFlowStyleprotected ScalarStyledefaultScalarStyleprotected RepresentToNodenullRepresenterin Java 'null' is not a type.protected ObjectobjectToRepresentprotected Map<Class<?>,RepresentToNode>parentClassRepresentersKeep representers which match a parent of the class to be representedprotected Map<Object,Node>representedObjectsprotected Map<Class<?>,RepresentToNode>representersKeep representers which must match the class exactly
-
Constructor Summary
Constructors Constructor Description BaseRepresenter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Optional<RepresentToNode>findRepresenterFor(Object data)Find the representer which is suitable to represent the internal structure of the provided instance to a NodeNoderepresent(Object data)Represent the provided Java instance to a Nodeprotected NoderepresentData(Object data)protected NoderepresentMapping(Tag tag, Map<?,?> mapping, FlowStyle flowStyle)protected NoderepresentScalar(Tag tag, String value)protected NoderepresentScalar(Tag tag, String value, ScalarStyle style)protected NoderepresentSequence(Tag tag, Iterable<?> sequence, FlowStyle flowStyle)
-
-
-
Field Detail
-
representers
protected final Map<Class<?>,RepresentToNode> representers
Keep representers which must match the class exactly
-
nullRepresenter
protected RepresentToNode nullRepresenter
in Java 'null' is not a type. So we have to keep the null representer separately otherwise it will coincide with the default representer which is stored with the key null.
-
parentClassRepresenters
protected final Map<Class<?>,RepresentToNode> parentClassRepresenters
Keep representers which match a parent of the class to be represented
-
defaultScalarStyle
protected ScalarStyle defaultScalarStyle
-
defaultFlowStyle
protected FlowStyle defaultFlowStyle
-
objectToRepresent
protected Object objectToRepresent
-
-
Method Detail
-
represent
public Node represent(Object data)
Represent the provided Java instance to a Node- Parameters:
data- - Java instance to be represented- Returns:
- The Node to be serialized
-
findRepresenterFor
protected Optional<RepresentToNode> findRepresenterFor(Object data)
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
-
representScalar
protected Node representScalar(Tag tag, String value, ScalarStyle style)
-
representSequence
protected Node representSequence(Tag tag, Iterable<?> sequence, FlowStyle flowStyle)
-
-