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 LoadSettingskeep 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 ObjectConstruct complete YAML document.constructMapping(MappingNode node) Create filled Map from the provided Nodeprotected voidconstructMapping2ndStep(MappingNode node, Map<Object, Object> mapping) Fill the mapping with the data from provided nodeprotected ObjectconstructObject(Node node) Construct object from the specified Node.protected ObjectconstructObjectNoCheck(Node node) Construct object from the specified Node.protected StringconstructScalar(ScalarNode node) Create String from the provided scalar nodeCreate instance of Listprotected voidconstructSequenceStep2(SequenceNode node, Collection<Object> collection) Fill the collection with the data from provided nodeconstructSet(MappingNode node) Create instance of Set from mapping nodeprotected voidconstructSet2ndStep(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 voidprotected Optional<ConstructNode> findConstructorFor(Node node) protected voidif 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 voidpostponeSetFilling(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>, BaseConstructor.RecursiveTuple<Object, maps2fillObject>>> -
sets2fill
-
settings
keep the settings
-
-
Constructor Details
-
BaseConstructor
Create- Parameters:
settings- - the configuration option
-
-
Method Details
-
constructSingleDocument
-
construct
-
fillRecursive
private void fillRecursive() -
constructObject
-
constructObjectNoCheck
-
findConstructorFor
- Parameters:
node-Nodeto construct an instance from- Returns:
ConstructNodeimplementation 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
-