Class BaseConstructor
java.lang.Object
org.snakeyaml.engine.v2.constructor.BaseConstructor
- Direct Known Subclasses:
StandardConstructor
Base code
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ArrayList
<BaseConstructor.RecursiveTuple<Map<Object, Object>, BaseConstructor.RecursiveTuple<Object, Object>>> private final ArrayList
<BaseConstructor.RecursiveTuple<Set<Object>, Object>> protected LoadSettings
keep the settingsprotected final Map
<Tag, ConstructNode> It maps the (explicit or implicit) tag to the Construct implementation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
Construct complete YAML document.constructMapping
(MappingNode node) Create filled Map from the provided Nodeprotected void
constructMapping2ndStep
(MappingNode node, Map<Object, Object> mapping) Fill the mapping with the data from provided nodeprotected Object
constructObject
(Node node) Construct object from the specified Node.protected Object
constructObjectNoCheck
(Node node) Construct object from the specified Node.protected String
constructScalar
(ScalarNode node) Create String from the provided scalar nodeCreate instance of Listprotected void
constructSequenceStep2
(SequenceNode node, Collection<Object> collection) Fill the collection with the data from provided nodeconstructSet
(MappingNode node) Create instance of Set from mapping nodeprotected void
constructSet2ndStep
(MappingNode node, Set<Object> set) Fill the Map with the data from the nodeconstructSingleDocument
(Optional<Node> optionalNode) Ensure that the stream contains a single document and construct itCreate List implementation.createEmptyMapFor
(MappingNode node) Create Map implementation.Create Set implementation.private void
protected Optional
<ConstructNode> findConstructorFor
(Node node) protected void
if keyObject is created it 2 steps we should postpone putting it in map because it may have different hash after initialization compared to clean just created one.protected void
postponeSetFilling
(Set<Object> set, Object key) if keyObject is created it 2 steps we should postpone putting it into the set because it may have different hash after initialization compared to clean just created one.
-
Field Details
-
tagConstructors
It maps the (explicit or implicit) tag to the Construct implementation. -
constructedObjects
-
recursiveObjects
-
maps2fill
private final ArrayList<BaseConstructor.RecursiveTuple<Map<Object,Object>, maps2fillBaseConstructor.RecursiveTuple<Object, Object>>> -
sets2fill
-
settings
keep the settings
-
-
Constructor Details
-
BaseConstructor
Create- Parameters:
settings
- - the configuration option
-
-
Method Details
-
constructSingleDocument
Ensure that the stream contains a single document and construct it- Parameters:
optionalNode
- - composed Node- Returns:
- constructed instance
-
construct
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
-
fillRecursive
private void fillRecursive() -
constructObject
Construct object from the specified Node. Return existing instance if the node is already constructed.- Parameters:
node
- Node to be constructed- Returns:
- Java instance
-
constructObjectNoCheck
Construct object from the specified Node. It does not check if existing instance the node is already constructed.- Parameters:
node
- - the source- Returns:
- instantiated object
-
findConstructorFor
- Parameters:
node
-Node
to construct an instance from- Returns:
ConstructNode
implementation for the specified node
-
constructScalar
Create String from the provided scalar node- Parameters:
node
- - the source- Returns:
- value of the scalar node
-
createEmptyListForNode
Create List implementation. By default, it returns the value configured in the settings in getDefaultList(). Any custom List implementation can be provided.- Parameters:
node
- - the node to fill the List- Returns:
- empty List to fill
-
createEmptySetForNode
Create Set implementation. By default, it returns the value configured in the settings in getDefaultSet(). Any custom Set implementation can be provided.- Parameters:
node
- - the node to fill the Set- Returns:
- empty Set to fill
-
createEmptyMapFor
Create Map implementation. By default, it returns the value configured in the settings in getDefaultMap(). Any custom Map implementation can be provided.- Parameters:
node
- - the node to fill the Map- Returns:
- empty Map to fill
-
constructSequence
Create instance of List- Parameters:
node
- - the source- Returns:
- filled List
-
constructSequenceStep2
Fill the collection with the data from provided node- Parameters:
node
- - the sourcecollection
- - the collection to fill
-
constructSet
Create instance of Set from mapping node- Parameters:
node
- - the source- Returns:
- filled Set
-
constructMapping
Create filled Map from the provided Node- Parameters:
node
- - the source- Returns:
- filled Map
-
constructMapping2ndStep
Fill the mapping with the data from provided node- Parameters:
node
- - the sourcemapping
- - empty map to be filled
-
postponeMapFilling
if keyObject is created it 2 steps we should postpone putting it in map because it may have different hash after initialization compared to clean just created one. And map of course does not observe key hashCode changes.- Parameters:
mapping
- - the mapping to add key/valuekey
- - the key to add to mapvalue
- - the value behind the key
-
constructSet2ndStep
Fill the Map with the data from the node- Parameters:
node
- - the sourceset
- - empty set to fill
-
postponeSetFilling
if keyObject is created it 2 steps we should postpone putting it into the set because it may have different hash after initialization compared to clean just created one. And set of course does not observe value hashCode changes.- Parameters:
set
- - the set to add the keykey
- - the item to add to the set
-