Package org.yaml.snakeyaml.nodes
Class Node
- java.lang.Object
-
- org.yaml.snakeyaml.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
, and later transformed into application specific Java classes by the classes from theorg.yaml.snakeyaml.constructor
package.
-
-
Field Summary
Fields Modifier and Type Field Description protected Mark
endMark
protected boolean
resolved
true when the tag is assigned by the resolverprotected Boolean
useClassConstructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(Object obj)
Node is only equal to itselfMark
getEndMark()
abstract NodeId
getNodeId()
Mark
getStartMark()
Tag
getTag()
Tag of this node.Class<? extends Object>
getType()
int
hashCode()
boolean
isResolved()
Deprecated.Since v1.22.boolean
isTwoStepsConstruction()
Indicates if this node must be constructed in two steps.void
setTag(Tag tag)
void
setTwoStepsConstruction(boolean twoStepsConstruction)
void
setType(Class<? extends Object> type)
void
setUseClassConstructor(Boolean useClassConstructor)
boolean
useClassConstructor()
-
-
-
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.
-
getEndMark
public Mark getEndMark()
-
getNodeId
public abstract NodeId getNodeId()
- Returns:
- scalar, sequence, mapping
-
getStartMark
public Mark getStartMark()
-
setTag
public void setTag(Tag tag)
-
equals
public final boolean equals(Object obj)
Node is only equal to itself
-
setTwoStepsConstruction
public void setTwoStepsConstruction(boolean twoStepsConstruction)
-
isTwoStepsConstruction
public boolean isTwoStepsConstruction()
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:
true
if the node is self referenced.
-
useClassConstructor
public boolean useClassConstructor()
-
setUseClassConstructor
public void setUseClassConstructor(Boolean useClassConstructor)
-
isResolved
@Deprecated public boolean isResolved()
Deprecated.Since v1.22. Absent in immediately prior versions, but present previously. Restored deprecated for backwards compatibility.Indicates if the tag was added byResolver
.- Returns:
- true if the tag of this node was resolved
-
-