Package org.yaml.snakeyaml.nodes
Class Node
java.lang.Object
org.yaml.snakeyaml.nodes.Node
- Direct Known Subclasses:
AnchorNode
,CollectionNode
,ScalarNode
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 the org.yaml.snakeyaml.constructor
package.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private List<CommentLine>
private List<CommentLine>
protected Mark
private List<CommentLine>
protected boolean
true when the tag is assigned by the resolverprivate final Mark
private Tag
private boolean
protected Boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Node is only equal to itselfThe ordered list of blank lines and block comments (full line) that appear before this node.The ordered list of blank lines and block comments (full line) that appear AFTER this node.The ordered list of in-line comments.abstract NodeId
For error reporting.getTag()
Tag of this node.getType()
final int
hashCode()
boolean
Deprecated.Since v1.22.boolean
Indicates if this node must be constructed in two steps.void
void
setBlockComments
(List<CommentLine> blockComments) void
setEndComments
(List<CommentLine> endComments) void
setInLineComments
(List<CommentLine> inLineComments) void
void
setTwoStepsConstruction
(boolean twoStepsConstruction) void
void
setUseClassConstructor
(Boolean useClassConstructor) boolean
-
Field Details
-
tag
-
startMark
-
endMark
-
type
-
twoStepsConstruction
private boolean twoStepsConstruction -
anchor
-
inLineComments
-
blockComments
-
endComments
-
resolved
protected boolean resolvedtrue when the tag is assigned by the resolver -
useClassConstructor
-
-
Constructor Details
-
Node
-
-
Method Details
-
getTag
Tag of this node.Every node has a tag assigned. The tag is either local or global.
- Returns:
- Tag of this node.
-
getEndMark
-
getNodeId
For error reporting.- Returns:
- scalar, sequence, mapping
- See Also:
-
- "class variable 'id' in PyYAML"
-
getStartMark
-
setTag
-
equals
Node is only equal to itself -
getType
-
setType
-
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.
-
hashCode
public final int hashCode() -
useClassConstructor
public boolean useClassConstructor() -
setUseClassConstructor
-
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
-
getAnchor
-
setAnchor
-
getInLineComments
The ordered list of in-line comments. The first of which appears at the end of the line respresent by this node. The rest are in the following lines, indented per the Spec to indicate they are continuation of the inline comment.- Returns:
- the comment line list.
-
setInLineComments
-
getBlockComments
The ordered list of blank lines and block comments (full line) that appear before this node.- Returns:
- the comment line list.
-
setBlockComments
-
getEndComments
The ordered list of blank lines and block comments (full line) that appear AFTER this node.NOTE: these comment should occur only in the last node in a document, when walking the node tree "in order"
- Returns:
- the comment line list.
-
setEndComments
-