org.elasticsearch.util.yaml.snakeyaml.constructor
Class BaseConstructor

java.lang.Object
  extended by org.elasticsearch.util.yaml.snakeyaml.constructor.BaseConstructor
Direct Known Subclasses:
SafeConstructor

public abstract class BaseConstructor
extends java.lang.Object

See Also:
PyYAML for more information

Field Summary
protected  Tag rootTag
           
protected  java.util.Map<NodeId,Construct> yamlClassConstructors
          It maps the node kind to the the Construct implementation.
protected  java.util.Map<Tag,Construct> yamlConstructors
          It maps the (explicit or implicit) tag to the Construct implementation.
protected  java.util.Map<java.lang.String,Construct> yamlMultiConstructors
          It maps the (explicit or implicit) tag to the Construct implementation.
 
Constructor Summary
BaseConstructor()
           
 
Method Summary
 boolean checkData()
          Check if more documents available
protected  java.util.Map<java.lang.Object,java.lang.Object> constructMapping(MappingNode node)
           
protected  void constructMapping2ndStep(MappingNode node, java.util.Map<java.lang.Object,java.lang.Object> mapping)
           
protected  java.lang.Object constructObject(YamlNode node)
          Construct object from the specified Node.
protected  java.lang.Object constructScalar(ScalarNode node)
           
protected  java.util.List<? extends java.lang.Object> constructSequence(SequenceNode node)
           
protected  void constructSequenceStep2(SequenceNode node, java.util.List<java.lang.Object> list)
           
protected  java.util.Set<java.lang.Object> constructSet(MappingNode node)
           
protected  void constructSet2ndStep(MappingNode node, java.util.Set<java.lang.Object> set)
           
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  Construct getConstructor(YamlNode node)
          Get the constructor to construct the Node.
 java.lang.Object getData()
          Construct and return the next document
 java.lang.Object getSingleData()
          Ensure that the stream contains a single document and construct it
 void setComposer(Composer composer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.


rootTag

protected Tag rootTag
Constructor Detail

BaseConstructor

public BaseConstructor()
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()
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

constructObject

protected java.lang.Object constructObject(YamlNode 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(YamlNode 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)

constructSequence

protected java.util.List<? extends java.lang.Object> constructSequence(SequenceNode node)

constructSequenceStep2

protected void constructSequenceStep2(SequenceNode node,
                                      java.util.List<java.lang.Object> list)

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)