Top Description Inners Fields Constructors Methods
org.yaml.snakeyaml.constructor

public Class Constructor

extends SafeConstructor
Class Inheritance
Known Direct Subclasses
org.yaml.snakeyaml.constructor.CustomClassLoaderConstructor, org.yaml.snakeyaml.env.EnvScalarConstructor, org.yaml.snakeyaml.extensions.compactnotation.CompactConstructor
Imports
java.math.BigDecimal, .BigInteger, java.util.ArrayList, .Calendar, .Collection, .Date, .List, .Map, .Set, .UUID, org.yaml.snakeyaml.LoaderOptions, .TypeDescription, org.yaml.snakeyaml.error.YAMLException, org.yaml.snakeyaml.introspector.Property, org.yaml.snakeyaml.nodes.MappingNode, .Node, .NodeId, .NodeTuple, .ScalarNode, .SequenceNode, .Tag, org.yaml.snakeyaml.util.EnumUtils

Construct a custom Java instance.

Nested and Inner Type Summary

Modifier and TypeClass and Description
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.

Field Summary

Inherited from org.yaml.snakeyaml.constructor.SafeConstructor:
undefinedConstructor

Constructor Summary

AccessConstructor and Description
public
Constructor(LoaderOptions
- config
loadingConfig
)

Create with options

public
Constructor(Class<? extends Object>
- the class to create (to be the root of the YAML document)
theRoot
,
LoaderOptions
- options
loadingConfig
)

Create

public
Constructor(TypeDescription
- the root class to create
theRoot
,
LoaderOptions
options
loadingConfig
)

Create

public
Constructor(TypeDescription
- the class (usually JavaBean) to be constructed
theRoot
,
Collection<TypeDescription>
- collection of classes used by the root class
moreTDs
,
LoaderOptions
- configuration
loadingConfig
)

Create with all possible arguments

public
Constructor(String
- the main class to crate
theRoot
,
LoaderOptions
- options
loadingConfig
)

Create

Method Summary

Modifier and TypeMethod and Description
private static String
private static Class<? extends Object>
checkRoot(Class<? extends Object> theRoot)

Ugly Java way to check the argument in the constructor

protected Class<?>
protected Class<?>
Inherited from org.yaml.snakeyaml.constructor.SafeConstructor:
constructMapping2ndStepconstructSet2ndStepcreateLongOrBigIntegerflattenMappingflattenMappingprocessDuplicateKeysprocessDuplicateKeys

Constructor Detail

Constructorback to summary
public Constructor(LoaderOptions loadingConfig)

Create with options

Parameters
loadingConfig:LoaderOptions

- config

Constructorback to summary
public Constructor(Class<? extends Object> theRoot, LoaderOptions loadingConfig)

Create

Parameters
theRoot:Class<? extends Object>

- the class to create (to be the root of the YAML document)

loadingConfig:LoaderOptions

- options

Constructorback to summary
public Constructor(TypeDescription theRoot, LoaderOptions loadingConfig)

Create

Parameters
theRoot:TypeDescription

- the root class to create

loadingConfig:LoaderOptions

options

Constructorback to summary
public Constructor(TypeDescription theRoot, Collection<TypeDescription> moreTDs, LoaderOptions loadingConfig)

Create with all possible arguments

Parameters
theRoot:TypeDescription

- the class (usually JavaBean) to be constructed

moreTDs:Collection<TypeDescription>

- collection of classes used by the root class

loadingConfig:LoaderOptions

- configuration

Constructorback to summary
public Constructor(String theRoot, LoaderOptions loadingConfig) throws ClassNotFoundException

Create

Parameters
theRoot:String

- the main class to crate

loadingConfig:LoaderOptions

- options

Exceptions
ClassNotFoundException:
if something goes wrong

Method Detail

checkback to summary
private static String check(String s)
checkRootback to summary
private static Class<? extends Object> checkRoot(Class<? extends Object> theRoot)

Ugly Java way to check the argument in the constructor

getClassForNameback to summary
protected Class<?> getClassForName(String name) throws ClassNotFoundException
getClassForNodeback to summary
protected Class<?> getClassForNode(Node node)
org.yaml.snakeyaml.constructor back to summary

protected Class Constructor.ConstructMapping

extends Object
implements Construct
Class Inheritance
All Implemented Interfaces
org.yaml.snakeyaml.constructor.Construct
Known Direct Subclasses
org.yaml.snakeyaml.extensions.compactnotation.CompactConstructor.ConstructCompactObject

Construct mapping instance (Map, JavaBean) when the runtime class is known.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

constructed JavaBean
construct
(Node
node where the keys are property names (they can only be Strings) and values are objects to be created
node
)

Implements org.yaml.snakeyaml.constructor.Construct.construct.

Construct JavaBean.
public void
construct2ndStep(Node
composed Node
node
,
Object
the instance constructed earlier by construct(Node node) for the provided Node
object
)

Implements org.yaml.snakeyaml.constructor.Construct.construct2ndStep.

Apply the second step when constructing recursive structures.
protected Object
protected Property
getProperty(Class<? extends Object> type, String name)

private Object
newInstance(TypeDescription memberDescription, String propertyName, Node node)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ConstructMappingback to summary
protected ConstructMapping()

Method Detail

constructback to summary
public Object construct(Node node)

Implements org.yaml.snakeyaml.constructor.Construct.construct.

Construct JavaBean. If type safe collections are used please look at TypeDescription.

Parameters
node:Node

node where the keys are property names (they can only be Strings) and values are objects to be created

Returns:Object

constructed JavaBean

construct2ndStepback to summary
public void construct2ndStep(Node node, Object object)

Implements org.yaml.snakeyaml.constructor.Construct.construct2ndStep.

Doc from org.yaml.snakeyaml.constructor.Construct.construct2ndStep.

Apply the second step when constructing recursive structures. Because the instance is already created it can assign a reference to itself.

Parameters
node:Node

composed Node

object:Object

the instance constructed earlier by construct(Node node) for the provided Node

Annotations
@SuppressWarnings:unchecked
constructJavaBean2ndStepback to summary
protected Object constructJavaBean2ndStep(MappingNode node, Object object)
getPropertyback to summary
protected Property getProperty(Class<? extends Object> type, String name)
newInstanceback to summary
private Object newInstance(TypeDescription memberDescription, String propertyName, Node node)
org.yaml.snakeyaml.constructor back to summary

protected Class Constructor.ConstructScalar

extends AbstractConstruct
Class Inheritance

Construct scalar instance when the runtime class is known. Recursive structures are not supported.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public Object
construct(Node
composed Node
nnode
)

Implements org.yaml.snakeyaml.constructor.Construct.construct.

Construct a Java instance with all the properties injected when it is possible.
private Object
Inherited from org.yaml.snakeyaml.constructor.AbstractConstruct:
construct2ndStep

Constructor Detail

ConstructScalarback to summary
protected ConstructScalar()

Method Detail

constructback to summary
public Object construct(Node nnode)

Implements org.yaml.snakeyaml.constructor.Construct.construct.

Doc from org.yaml.snakeyaml.constructor.Construct.construct.

Construct a Java instance with all the properties injected when it is possible.

Parameters
nnode:Node

composed Node

Returns:Object

a complete Java instance

constructStandardJavaInstanceback to summary
private Object constructStandardJavaInstance(Class<T> type, ScalarNode node)
Annotations
@SuppressWarnings:unchecked
org.yaml.snakeyaml.constructor back to summary

protected Class Constructor.ConstructSequence

extends Object
implements Construct
Class Inheritance
All Implemented Interfaces
org.yaml.snakeyaml.constructor.Construct

Construct sequence (List, Array, or immutable object) when the runtime class is known.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public Object
construct(Node
composed Node
node
)

Implements org.yaml.snakeyaml.constructor.Construct.construct.

Construct a Java instance with all the properties injected when it is possible.
public void
construct2ndStep(Node
composed Node
node
,
Object
the instance constructed earlier by construct(Node node) for the provided Node
object
)

Implements org.yaml.snakeyaml.constructor.Construct.construct2ndStep.

Apply the second step when constructing recursive structures.
private Class<? extends Object>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ConstructSequenceback to summary
protected ConstructSequence()

Method Detail

constructback to summary
public Object construct(Node node)

Implements org.yaml.snakeyaml.constructor.Construct.construct.

Doc from org.yaml.snakeyaml.constructor.Construct.construct.

Construct a Java instance with all the properties injected when it is possible.

Parameters
node:Node

composed Node

Returns:Object

a complete Java instance

Annotations
@SuppressWarnings:unchecked
construct2ndStepback to summary
public void construct2ndStep(Node node, Object object)

Implements org.yaml.snakeyaml.constructor.Construct.construct2ndStep.

Doc from org.yaml.snakeyaml.constructor.Construct.construct2ndStep.

Apply the second step when constructing recursive structures. Because the instance is already created it can assign a reference to itself.

Parameters
node:Node

composed Node

object:Object

the instance constructed earlier by construct(Node node) for the provided Node

Annotations
@SuppressWarnings:unchecked
wrapIfPrimitiveback to summary
private Class<? extends Object> wrapIfPrimitive(Class<?> clazz)
org.yaml.snakeyaml.constructor back to summary

protected Class Constructor.ConstructYamlObject

extends Object
implements Construct
Class Inheritance
  • java.lang.Object
  • org.yaml.snakeyaml.constructor.Constructor.ConstructYamlObject
All Implemented Interfaces
org.yaml.snakeyaml.constructor.Construct

Construct an instance when the runtime class is not known but a global tag with a class name is defined. It delegates the construction to the appropriate constructor based on the node kind (scalar, sequence, mapping)

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public Object
construct(Node
composed Node
node
)

Implements org.yaml.snakeyaml.constructor.Construct.construct.

Construct a Java instance with all the properties injected when it is possible.
public void
construct2ndStep(Node
composed Node
node
,
Object
the instance constructed earlier by construct(Node node) for the provided Node
object
)

Implements org.yaml.snakeyaml.constructor.Construct.construct2ndStep.

Apply the second step when constructing recursive structures.
private Construct
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ConstructYamlObjectback to summary
protected ConstructYamlObject()

Method Detail

constructback to summary
public Object construct(Node node)

Implements org.yaml.snakeyaml.constructor.Construct.construct.

Doc from org.yaml.snakeyaml.constructor.Construct.construct.

Construct a Java instance with all the properties injected when it is possible.

Parameters
node:Node

composed Node

Returns:Object

a complete Java instance

construct2ndStepback to summary
public void construct2ndStep(Node node, Object object)

Implements org.yaml.snakeyaml.constructor.Construct.construct2ndStep.

Doc from org.yaml.snakeyaml.constructor.Construct.construct2ndStep.

Apply the second step when constructing recursive structures. Because the instance is already created it can assign a reference to itself.

Parameters
node:Node

composed Node

object:Object

the instance constructed earlier by construct(Node node) for the provided Node

getConstructorback to summary
private Construct getConstructor(Node node)