org.yaml.snakeyaml.constructor
Class BaseConstructor

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

public abstract class BaseConstructor
extends Object

See Also:
PyYAML for more information

Field Summary
protected  String rootTag
           
protected  Map<NodeId,Construct> yamlClassConstructors
          It maps the node kind to the the Construct implementation.
protected  Map<String,Construct> yamlConstructors
          It maps the (explicit or implicit) tag to the Construct implementation.
 
Constructor Summary
BaseConstructor()
           
 
Method Summary
protected  Object callConstructor(Node node)
          Create Java instance from the specified Node
protected  void callPostCreate(Node node, Object object)
           
 boolean checkData()
          Check if more documents available
protected  Map<Object,Object> constructMapping(MappingNode node)
           
protected  void constructMapping2ndStep(MappingNode node, Map<Object,Object> mapping)
           
protected  Object constructObject(Node node)
          Construct object from the specified Node.
protected  Object constructScalar(ScalarNode node)
           
protected  List<? extends Object> constructSequence(SequenceNode node)
           
protected  void constructSequenceStep2(SequenceNode node, List<Object> list)
           
protected  Set<Object> constructSet(MappingNode node)
           
protected  void constructSet2ndStep(MappingNode node, Set<Object> set)
           
protected  List<Object> createDefaultList(int initSize)
           
protected  Map<Object,Object> createDefaultMap()
           
protected  Set<Object> createDefaultSet()
           
 Object getData()
          Construct and return the next document
 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 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 Map<String,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)


rootTag

protected String 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 Object getData()
Construct and return the next document

Returns:
constructed instance

getSingleData

public 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 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

callConstructor

protected Object callConstructor(Node node)
Create Java instance from the specified Node

Parameters:
node - Node to be constructed
Returns:
Java instance

callPostCreate

protected void callPostCreate(Node node,
                              Object object)

constructScalar

protected Object constructScalar(ScalarNode node)

createDefaultList

protected List<Object> createDefaultList(int initSize)

constructSequence

protected List<? extends Object> constructSequence(SequenceNode node)

constructSequenceStep2

protected void constructSequenceStep2(SequenceNode node,
                                      List<Object> list)

createDefaultMap

protected Map<Object,Object> createDefaultMap()

createDefaultSet

protected Set<Object> createDefaultSet()

constructSet

protected Set<Object> constructSet(MappingNode node)

constructMapping

protected Map<Object,Object> constructMapping(MappingNode node)

constructMapping2ndStep

protected void constructMapping2ndStep(MappingNode node,
                                       Map<Object,Object> mapping)

constructSet2ndStep

protected void constructSet2ndStep(MappingNode node,
                                   Set<Object> set)


Copyright © 2008-2010. All Rights Reserved.