Package org.yaml.snakeyaml.constructor
Class BaseConstructor
- java.lang.Object
-
- org.yaml.snakeyaml.constructor.BaseConstructor
-
- Direct Known Subclasses:
SafeConstructor
public abstract class BaseConstructor extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected Composercomposerprotected TagrootTagprotected java.util.Map<NodeId,Construct>yamlClassConstructorsIt maps the node kind to the the Construct implementation.protected java.util.Map<Tag,Construct>yamlConstructorsIt maps the (explicit or implicit) tag to the Construct implementation.protected java.util.Map<java.lang.String,Construct>yamlMultiConstructorsIt maps the (explicit or implicit) tag to the Construct implementation.
-
Constructor Summary
Constructors Constructor Description BaseConstructor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckData()Check if more documents availableprotected java.lang.ObjectconstructArray(SequenceNode node)protected java.lang.ObjectconstructArrayStep2(SequenceNode node, java.lang.Object array)protected java.lang.ObjectconstructDocument(Node node)Construct complete YAML document.protected java.util.Map<java.lang.Object,java.lang.Object>constructMapping(MappingNode node)protected voidconstructMapping2ndStep(MappingNode node, java.util.Map<java.lang.Object,java.lang.Object> mapping)protected java.lang.ObjectconstructObject(Node node)Construct object from the specified Node.protected java.lang.ObjectconstructScalar(ScalarNode node)protected java.util.List<? extends java.lang.Object>constructSequence(SequenceNode node)protected voidconstructSequenceStep2(SequenceNode node, java.util.Collection<java.lang.Object> collection)protected java.util.Set<java.lang.Object>constructSet(MappingNode node)protected java.util.Set<? extends java.lang.Object>constructSet(SequenceNode node)protected voidconstructSet2ndStep(MappingNode node, java.util.Set<java.lang.Object> set)protected java.lang.ObjectcreateArray(java.lang.Class<?> type, int size)protected java.util.List<java.lang.Object>createDefaultList(int initSize)protected java.util.Map<java.lang.Object,java.lang.Object>createDefaultMap()protected java.util.Set<java.lang.Object>createDefaultSet()protected java.util.Set<java.lang.Object>createDefaultSet(int initSize)protected ConstructgetConstructor(Node node)Get the constructor to construct the Node.java.lang.ObjectgetData()Construct and return the next documentPropertyUtilsgetPropertyUtils()java.lang.ObjectgetSingleData(java.lang.Class<?> type)Ensure that the stream contains a single document and construct itbooleanisExplicitPropertyUtils()voidsetComposer(Composer composer)voidsetPropertyUtils(PropertyUtils propertyUtils)
-
-
-
Field Detail
-
yamlClassConstructors
protected final java.util.Map<NodeId,Construct> yamlClassConstructors
It maps the node kind to the the Construct implementation. When the runtime class is known then the implicit tag is ignored.
-
yamlConstructors
protected final java.util.Map<Tag,Construct> yamlConstructors
It maps the (explicit or implicit) tag to the Construct implementation. It is used:
1) explicit tag - if present.
2) implicit tag - when the runtime class of the instance is unknown (the node has the Object.class)
-
yamlMultiConstructors
protected final java.util.Map<java.lang.String,Construct> yamlMultiConstructors
It maps the (explicit or implicit) tag to the Construct implementation. It is used when no exact match found.
-
composer
protected Composer composer
-
rootTag
protected Tag rootTag
-
-
Method Detail
-
setComposer
public void setComposer(Composer composer)
-
checkData
public boolean checkData()
Check if more documents available- Returns:
- true when there are more YAML documents in the stream
-
getData
public java.lang.Object getData()
Construct and return the next document- Returns:
- constructed instance
-
getSingleData
public java.lang.Object getSingleData(java.lang.Class<?> type)
Ensure that the stream contains a single document and construct it- Returns:
- constructed instance
- Throws:
ComposerException- in case there are more documents in the stream
-
constructDocument
protected final java.lang.Object constructDocument(Node node)
Construct complete YAML document. Call the second step in case of recursive structures. At the end cleans all the state.- Parameters:
node- root Node- Returns:
- Java instance
-
constructObject
protected java.lang.Object constructObject(Node node)
Construct object from the specified Node. Return existing instance if the node is already constructed.- Parameters:
node- Node to be constructed- Returns:
- Java instance
-
getConstructor
protected Construct getConstructor(Node node)
Get the constructor to construct the Node. For implicit tags if the runtime class is known a dedicated Construct implementation is used. Otherwise the constructor is chosen by the tag.- Parameters:
node- Node to be constructed- Returns:
- Construct implementation for the specified node
-
constructScalar
protected java.lang.Object constructScalar(ScalarNode node)
-
createDefaultList
protected java.util.List<java.lang.Object> createDefaultList(int initSize)
-
createDefaultSet
protected java.util.Set<java.lang.Object> createDefaultSet(int initSize)
-
createArray
protected java.lang.Object createArray(java.lang.Class<?> type, int size)
-
constructSequence
protected java.util.List<? extends java.lang.Object> constructSequence(SequenceNode node)
-
constructSet
protected java.util.Set<? extends java.lang.Object> constructSet(SequenceNode node)
-
constructArray
protected java.lang.Object constructArray(SequenceNode node)
-
constructSequenceStep2
protected void constructSequenceStep2(SequenceNode node, java.util.Collection<java.lang.Object> collection)
-
constructArrayStep2
protected java.lang.Object constructArrayStep2(SequenceNode node, java.lang.Object array)
-
createDefaultMap
protected java.util.Map<java.lang.Object,java.lang.Object> createDefaultMap()
-
createDefaultSet
protected java.util.Set<java.lang.Object> createDefaultSet()
-
constructSet
protected java.util.Set<java.lang.Object> constructSet(MappingNode node)
-
constructMapping
protected java.util.Map<java.lang.Object,java.lang.Object> constructMapping(MappingNode node)
-
constructMapping2ndStep
protected void constructMapping2ndStep(MappingNode node, java.util.Map<java.lang.Object,java.lang.Object> mapping)
-
constructSet2ndStep
protected void constructSet2ndStep(MappingNode node, java.util.Set<java.lang.Object> set)
-
setPropertyUtils
public void setPropertyUtils(PropertyUtils propertyUtils)
-
getPropertyUtils
public final PropertyUtils getPropertyUtils()
-
isExplicitPropertyUtils
public final boolean isExplicitPropertyUtils()
-
-