org.yaml.snakeyaml.constructor
Class Constructor

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

public class Constructor
extends SafeConstructor

Construct a custom Java instance.


Nested Class Summary
protected  class Constructor.ConstructMapping
          Construct mapping instance (Map, JavaBean) when the runtime class is known.
protected  class Constructor.ConstructScalar
          Construct scalar instance when the runtime class is known.
protected  class Constructor.ConstructSequence
          Construct sequence (List, Array, or immutable object) when the runtime class is known.
protected  class Constructor.ConstructYamlObject
          Construct an instance when the runtime class is not known but a global tag with a class name is defined.
 
Nested classes/interfaces inherited from class org.yaml.snakeyaml.constructor.SafeConstructor
SafeConstructor.ConstructUndefined, SafeConstructor.ConstructYamlBinary, SafeConstructor.ConstructYamlBool, SafeConstructor.ConstructYamlFloat, SafeConstructor.ConstructYamlInt, SafeConstructor.ConstructYamlMap, SafeConstructor.ConstructYamlNull, SafeConstructor.ConstructYamlOmap, SafeConstructor.ConstructYamlPairs, SafeConstructor.ConstructYamlSeq, SafeConstructor.ConstructYamlSet, SafeConstructor.ConstructYamlStr, SafeConstructor.ConstructYamlTimestamp
 
Field Summary
 
Fields inherited from class org.yaml.snakeyaml.constructor.SafeConstructor
undefinedConstructor
 
Fields inherited from class org.yaml.snakeyaml.constructor.BaseConstructor
rootTag, yamlClassConstructors, yamlConstructors, yamlMultiConstructors
 
Constructor Summary
Constructor()
           
Constructor(Class<? extends Object> theRoot)
          Create Constructor for the specified class as the root.
Constructor(String theRoot)
          Create Constructor for a class which does not have to be in the classpath or for a definition from a Spring ApplicationContext.
Constructor(TypeDescription theRoot)
           
 
Method Summary
 TypeDescription addTypeDescription(TypeDescription definition)
          Make YAML aware how to parse a custom Class.
protected  Class<?> getClassForName(String name)
           
protected  Class<?> getClassForNode(Node node)
           
 
Methods inherited from class org.yaml.snakeyaml.constructor.SafeConstructor
constructMapping2ndStep, constructSet2ndStep, flattenMapping
 
Methods inherited from class org.yaml.snakeyaml.constructor.BaseConstructor
checkData, constructArray, constructArrayStep2, constructMapping, constructObject, constructScalar, constructSequence, constructSequenceStep2, constructSet, constructSet, createArray, createDefaultList, createDefaultMap, createDefaultSet, createDefaultSet, getConstructor, getData, getPropertyUtils, getSingleData, isExplicitPropertyUtils, setComposer, setPropertyUtils
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Constructor

public Constructor()

Constructor

public Constructor(Class<? extends Object> theRoot)
Create Constructor for the specified class as the root.

Parameters:
theRoot - - the class (usually JavaBean) to be constructed

Constructor

public Constructor(TypeDescription theRoot)

Constructor

public Constructor(String theRoot)
            throws ClassNotFoundException
Create Constructor for a class which does not have to be in the classpath or for a definition from a Spring ApplicationContext.

Parameters:
theRoot - fully qualified class name of the root class (usually JavaBean)
Throws:
ClassNotFoundException
Method Detail

addTypeDescription

public TypeDescription addTypeDescription(TypeDescription definition)
Make YAML aware how to parse a custom Class. If there is no root Class assigned in constructor then the 'root' property of this definition is respected.

Parameters:
definition - to be added to the Constructor
Returns:
the previous value associated with definition, or null if there was no mapping for definition.

getClassForNode

protected Class<?> getClassForNode(Node node)

getClassForName

protected Class<?> getClassForName(String name)
                            throws ClassNotFoundException
Throws:
ClassNotFoundException


Copyright © 2008-2012. All Rights Reserved.