1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.yaml.snakeyaml.nodes;
17
18 import org.yaml.snakeyaml.error.Mark;
19
20
21
22
23
24
25
26 public class ScalarNode extends Node {
27 private Character style;
28 private String value;
29
30 public ScalarNode(Tag tag, String value, Mark startMark, Mark endMark, Character style) {
31 this(tag, true, value, startMark, endMark, style);
32 }
33
34 public ScalarNode(Tag tag, boolean resolved, String value, Mark startMark, Mark endMark,
35 Character style) {
36 super(tag, startMark, endMark);
37 if (value == null) {
38 throw new NullPointerException("value in a Node is required.");
39 }
40 this.value = value;
41 this.style = style;
42 this.resolved = resolved;
43 }
44
45
46
47
48
49
50
51
52 public Character getStyle() {
53 return style;
54 }
55
56 @Override
57 public NodeId getNodeId() {
58 return NodeId.scalar;
59 }
60
61
62
63
64
65
66 public String getValue() {
67 return value;
68 }
69
70 public String toString() {
71 return "<" + this.getClass().getName() + " (tag=" + getTag() + ", value=" + getValue()
72 + ")>";
73 }
74 }