forked from stleary/JSON-java
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJSONType.java
More file actions
30 lines (25 loc) · 799 Bytes
/
JSONType.java
File metadata and controls
30 lines (25 loc) · 799 Bytes
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
package org.json;
/**
* Common super type for {@link JSONArray} and {@link JSONObject},
* primarily to make traversing up containment hierarchies possible.
*
* @author Meinte Boersma
*/
abstract public class JSONType {
private JSONType container = null;
/**
* @return The container in the JSON containment tree or {@code null} if this is the root.
*/
public JSONType getContainer() {
return container;
}
/**
* Sets the container of this JSON object.
* @param container - the container object, <em>which then assumes responsibility over the containment link</em>.
* @return This JSON object, for chaining.
*/
protected <T extends JSONType> T setContainer(T container) {
this.container = container;
return container; // for chaining (with correct generic type)
}
}