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


Field Summary
protected  Tag rootTag
           
protected  Map<NodeId,Construct> yamlClassConstructors
          It maps the node kind to the the Construct implementation.
protected  Map<Tag,Construct> yamlConstructors
          It maps the (explicit or implicit) tag to the Construct implementation.
protected  Map<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  Object constructArray(SequenceNode node)
           
protected  Object constructArrayStep2(SequenceNode node, Object array)
           
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, Collection<Object> collection)
           
protected  Set<Object> constructSet(MappingNode node)
           
protected  Set<? extends Object> constructSet(SequenceNode node)
           
protected  void constructSet2ndStep(MappingNode node, Set<Object> set)
           
protected
<T> T[]
createArray(Class<T> type, int size)
           
protected  List<Object> createDefaultList(int initSize)
           
protected  Map<Object,Object> createDefaultMap()
           
protected  Set<Object> createDefaultSet()
           
protected  Set<Object> createDefaultSet(int initSize)
           
protected  Construct getConstructor(Node node)
          Get the constructor to construct the Node.
 Object getData()
          Construct and return the next document
 PropertyUtils getPropertyUtils()
           
 Object getSingleData(Class<?> type)
          Ensure that the stream contains a single document and construct it
 boolean isExplicitPropertyUtils()
           
 void setComposer(Composer composer)
           
 void setPropertyUtils(PropertyUtils propertyUtils)
           
 
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<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 Map<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 Object getData()
Construct and return the next document

Returns:
constructed instance

getSingleData

public Object getSingleData(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

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

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 Object constructScalar(ScalarNode node)

createDefaultList

protected List<Object> createDefaultList(int initSize)

createDefaultSet

protected Set<Object> createDefaultSet(int initSize)

createArray

protected <T> T[] createArray(Class<T> type,
                              int size)

constructSequence

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

constructSet

protected Set<? extends Object> constructSet(SequenceNode node)

constructArray

protected Object constructArray(SequenceNode node)

constructSequenceStep2

protected void constructSequenceStep2(SequenceNode node,
                                      Collection<Object> collection)

constructArrayStep2

protected Object constructArrayStep2(SequenceNode node,
                                     Object array)

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)

setPropertyUtils

public void setPropertyUtils(PropertyUtils propertyUtils)

getPropertyUtils

public final PropertyUtils getPropertyUtils()

isExplicitPropertyUtils

public final boolean isExplicitPropertyUtils()


Copyright © 2008-2011. All Rights Reserved.