Package org.snakeyaml.engine.v2.nodes
Class Node
- java.lang.Object
-
- org.snakeyaml.engine.v2.nodes.Node
-
- Direct Known Subclasses:
AnchorNode,CollectionNode,ScalarNode
public abstract class Node extends Object
Base class for all nodes.The nodes form the node-graph described in the YAML Specification.
While loading, the node graph is usually created by the
Composer.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Node is only equal to itselfOptional<Anchor>getAnchor()Get the anchor if it was defined for this NodeOptional<Mark>getEndMark()abstract NodeTypegetNodeType()ObjectgetProperty(String key)Get the custom runtime property.Optional<Mark>getStartMark()TaggetTag()Tag of this node.inthashCode()booleanisRecursive()Indicates if this node must be constructed in two steps.voidsetAnchor(Optional<Anchor> anchor)Set the anchor for this NodeObjectsetProperty(String key, Object value)Define a custom runtime property.voidsetRecursive(boolean recursive)voidsetTag(Tag tag)
-
-
-
Method Detail
-
getTag
public Tag getTag()
Tag of this node.Every node has a tag assigned. The tag is either local or global.
- Returns:
- Tag of this node.
-
getNodeType
public abstract NodeType getNodeType()
- Returns:
- scalar, sequence, mapping
-
setTag
public void setTag(Tag tag)
-
equals
public final boolean equals(Object obj)
Node is only equal to itself
-
setRecursive
public void setRecursive(boolean recursive)
-
isRecursive
public boolean isRecursive()
Indicates if this node must be constructed in two steps.Two-step construction is required whenever a node is a child (direct or indirect) of it self. That is, if a recursive structure is build using anchors and aliases.
Set by
Composer, used during the construction process.Only relevant during loading.
- Returns:
trueif the node is self referenced.
-
getAnchor
public Optional<Anchor> getAnchor()
Get the anchor if it was defined for this Node- Returns:
- the Anchor if available
- See Also:
- 3.2.2.2. Anchors and Aliases
-
setAnchor
public void setAnchor(Optional<Anchor> anchor)
Set the anchor for this Node- Parameters:
anchor- - the Anchor for this Node- See Also:
- 3.2.2.2. Anchors and Aliases
-
setProperty
public Object setProperty(String key, Object value)
Define a custom runtime property. It is not used by Engine but may be used by other tools.- Parameters:
key- - the key for the custom propertyvalue- - the value for the custom property- Returns:
- the previous value for the provided key if it was defined
-
-