blob: 82ae245b90504a90d58d0a09a1e935a49d27a011 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package model.html;
import org.json.JSONObject;
import persistance.JsonAble;
/**
* This TextNode class represents raw text, with no nested tags.
*/
public class TextNode implements Node, JsonAble {
private String text = "";
/**
* EFFECTS: Creates a new TextNode from the provided String value.
* MODIFIES: this
*/
public TextNode(String text) {
this.text = text;
}
public String getText() {
return this.text;
}
// We implement this method for easy debugging.
public String getData() {
return getText();
}
@Override
public JSONObject serialize() {
return new JSONObject(this);
}
}
|