Top Description Inners Fields Constructors Methods
org.yaml.snakeyaml.extensions.compactnotation

public Class CompactConstructor

extends Constructor
Class Inheritance
Known Direct Subclasses
org.yaml.snakeyaml.extensions.compactnotation.PackageCompactConstructor
Imports
java.util.HashMap, .Iterator, .List, .Map, .Set, java.util.regex.Matcher, .Pattern, org.yaml.snakeyaml.LoaderOptions, org.yaml.snakeyaml.constructor.Construct, .Constructor, org.yaml.snakeyaml.error.YAMLException, org.yaml.snakeyaml.introspector.Property, org.yaml.snakeyaml.nodes.MappingNode, .Node, .NodeTuple, .ScalarNode, .SequenceNode

Construct a custom Java instance out of a compact object notation format.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class

Field Summary

Modifier and TypeField and Description
private Construct
private static final Pattern
private static final Pattern
private static final Pattern

Constructor Summary

AccessConstructor and Description
public
CompactConstructor(LoaderOptions
- options
loadingConfig
)

Create with provided options

public
CompactConstructor()

Create with defaults

Method Summary

Modifier and TypeMethod and Description
protected void
applySequence(Object bean, List<?> value)

protected Object
protected Construct

Returns:

new instance
createCompactConstruct
()

Create

protected Object
private Construct

Returns:

instance
getCompactConstruct
()

Create if it does not exist

public CompactData
protected Construct
getConstructor(Node
Node to construct an instance from
node
)

Overrides org.yaml.snakeyaml.constructor.BaseConstructor.getConstructor.

Get the constructor to construct the Node.
protected String

Returns:

name of the List property
getSequencePropertyName
(Class<?>
the class to provide exactly one List property
bean
)

Provide the name of the property which is used when the entries form a sequence.

protected void
Inherited from org.yaml.snakeyaml.constructor.Constructor:
getClassForNamegetClassForNode

Field Detail

compactConstructback to summary
private Construct compactConstruct
FIRST_PATTERNback to summary
private static final Pattern FIRST_PATTERN
GUESS_COMPACTback to summary
private static final Pattern GUESS_COMPACT
PROPERTY_NAME_PATTERNback to summary
private static final Pattern PROPERTY_NAME_PATTERN

Constructor Detail

CompactConstructorback to summary
public CompactConstructor(LoaderOptions loadingConfig)

Create with provided options

Parameters
loadingConfig:LoaderOptions

- options

CompactConstructorback to summary
public CompactConstructor()

Create with defaults

Method Detail

applySequenceback to summary
protected void applySequence(Object bean, List<?> value)
constructCompactFormatback to summary
protected Object constructCompactFormat(ScalarNode node, CompactData data)
createCompactConstructback to summary
protected Construct createCompactConstruct()

Create

Returns:Construct

new instance

createInstanceback to summary
protected Object createInstance(ScalarNode node, CompactData data) throws Exception
getCompactConstructback to summary
private Construct getCompactConstruct()

Create if it does not exist

Returns:Construct

instance

getCompactDataback to summary
public CompactData getCompactData(String scalar)
getConstructorback to summary
protected Construct getConstructor(Node node)

Overrides org.yaml.snakeyaml.constructor.BaseConstructor.getConstructor.

Doc from org.yaml.snakeyaml.constructor.BaseConstructor.getConstructor.

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

Node to construct an instance from

Returns:Construct

Construct implementation for the specified node

Annotations
@Override
getSequencePropertyNameback to summary
protected String getSequencePropertyName(Class<?> bean)

Provide the name of the property which is used when the entries form a sequence. The property must be a List.

Parameters
bean:Class<?>

the class to provide exactly one List property

Returns:String

name of the List property

setPropertiesback to summary
protected void setProperties(Object bean, Map<String, Object> data) throws Exception
org.yaml.snakeyaml.extensions.compactnotation back to summary

public Class CompactConstructor.ConstructCompactObject

extends ConstructMapping
Class Inheritance

Custom ConstructMapping

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
construct(Node
node where the keys are property names (they can only be Strings) and values are objects to be created
node
)

Overrides org.yaml.snakeyaml.constructor.Constructor.ConstructMapping.construct.

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
)

Overrides org.yaml.snakeyaml.constructor.Constructor.ConstructMapping.construct2ndStep.

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

Apply the second step when constructing recursive structures.
Inherited from org.yaml.snakeyaml.constructor.Constructor.ConstructMapping:
constructJavaBean2ndStepgetProperty

Constructor Detail

ConstructCompactObjectback to summary
public ConstructCompactObject()

Method Detail

constructback to summary
public Object construct(Node node)

Overrides org.yaml.snakeyaml.constructor.Constructor.ConstructMapping.construct.

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

Doc from org.yaml.snakeyaml.constructor.Constructor.ConstructMapping.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)

Overrides org.yaml.snakeyaml.constructor.Constructor.ConstructMapping.construct2ndStep.

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
@Override