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