public abstract class BaseConstructor extends Object
Modifier and Type | Field and Description |
---|---|
protected Composer |
composer |
protected LoaderOptions |
loadingConfig |
protected Tag |
rootTag |
protected Map<Class<? extends Object>,TypeDescription> |
typeDefinitions |
protected Map<Tag,Class<? extends Object>> |
typeTags |
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 and Description |
---|
BaseConstructor() |
BaseConstructor(LoaderOptions loadingConfig) |
Modifier and Type | Method and Description |
---|---|
TypeDescription |
addTypeDescription(TypeDescription definition)
Make YAML aware how to parse a custom Class.
|
boolean |
checkData()
Check if more documents available
|
protected Object |
constructArray(SequenceNode node) |
protected Object |
constructArrayStep2(SequenceNode node,
Object array) |
protected Object |
constructDocument(Node node)
Construct complete YAML document.
|
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 |
constructObjectNoCheck(Node node) |
protected String |
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 Object |
createArray(Class<?> type,
int size) |
protected List<Object> |
createDefaultList(int initSize) |
protected Map<Object,Object> |
createDefaultMap(int initSize) |
protected Set<Object> |
createDefaultSet(int initSize) |
protected Object |
finalizeConstruction(Node node,
Object data) |
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 |
isAllowDuplicateKeys() |
boolean |
isExplicitPropertyUtils() |
boolean |
isWrappedToRootException() |
protected Object |
newInstance(Class<?> ancestor,
Node node) |
protected Object |
newInstance(Class<?> ancestor,
Node node,
boolean tryDefault) |
protected Object |
newInstance(Node node) |
protected List<Object> |
newList(SequenceNode node) |
protected Map<Object,Object> |
newMap(MappingNode node) |
protected Set<Object> |
newSet(CollectionNode<?> node) |
protected void |
postponeMapFilling(Map<Object,Object> mapping,
Object key,
Object value) |
protected void |
postponeSetFilling(Set<Object> set,
Object key) |
void |
setAllowDuplicateKeys(boolean allowDuplicateKeys) |
void |
setComposer(Composer composer) |
void |
setPropertyUtils(PropertyUtils propertyUtils) |
void |
setWrappedToRootException(boolean wrappedToRootException) |
protected final Map<NodeId,Construct> yamlClassConstructors
protected final Map<Tag,Construct> yamlConstructors
protected final Map<String,Construct> yamlMultiConstructors
protected Composer composer
protected Tag rootTag
protected final Map<Class<? extends Object>,TypeDescription> typeDefinitions
protected LoaderOptions loadingConfig
public BaseConstructor()
public BaseConstructor(LoaderOptions loadingConfig)
public void setComposer(Composer composer)
public boolean checkData()
public Object getData() throws NoSuchElementException
NoSuchElementException
public Object getSingleData(Class<?> type)
type
- the class of the instance being createdComposerException
- in case there are more documents in the streamprotected final Object constructDocument(Node node)
node
- root Nodeprotected Object constructObject(Node node)
node
- Node to be constructedprotected Construct getConstructor(Node node)
protected String constructScalar(ScalarNode node)
protected final Object newInstance(Class<?> ancestor, Node node) throws InstantiationException
InstantiationException
protected Object newInstance(Class<?> ancestor, Node node, boolean tryDefault) throws InstantiationException
InstantiationException
protected Set<Object> newSet(CollectionNode<?> node)
protected List<Object> newList(SequenceNode node)
protected Map<Object,Object> newMap(MappingNode node)
protected List<? extends Object> constructSequence(SequenceNode node)
protected Set<? extends Object> constructSet(SequenceNode node)
protected Object constructArray(SequenceNode node)
protected void constructSequenceStep2(SequenceNode node, Collection<Object> collection)
protected Object constructArrayStep2(SequenceNode node, Object array)
protected Set<Object> constructSet(MappingNode node)
protected Map<Object,Object> constructMapping(MappingNode node)
protected void constructMapping2ndStep(MappingNode node, Map<Object,Object> mapping)
protected void postponeMapFilling(Map<Object,Object> mapping, Object key, Object value)
protected void constructSet2ndStep(MappingNode node, Set<Object> set)
public void setPropertyUtils(PropertyUtils propertyUtils)
public final PropertyUtils getPropertyUtils()
public TypeDescription addTypeDescription(TypeDescription definition)
definition
- to be added to the Constructordefinition
, or
null
if there was no mapping for definition
.public final boolean isExplicitPropertyUtils()
public boolean isAllowDuplicateKeys()
public void setAllowDuplicateKeys(boolean allowDuplicateKeys)
public boolean isWrappedToRootException()
public void setWrappedToRootException(boolean wrappedToRootException)
Copyright © 2008–2020. All rights reserved.