public abstract class JsonStructure
extends java.lang.Object
JsonObject
or a JsonArray.
Created by Andrea Tortorella on 01/01/14.| Modifier and Type | Field and Description |
|---|---|
static int |
ABSENT |
static int |
ARRAY |
static int |
BOOLEAN |
static int |
NULL |
static int |
NUMBER |
static int |
OBJECT |
static int |
STRING |
| Modifier and Type | Method and Description |
|---|---|
JsonArray |
asArray()
Casts this structure to a
JsonArray |
JsonObject |
asObject()
Casts this structure to a
JsonObject |
abstract JsonStructure |
clear() |
abstract JsonStructure |
copy()
Creates a deeep copy of this structure.
|
static JsonStructure |
decode(java.lang.String text)
Decodes a string into a
JsonStructure |
abstract java.lang.String |
encode()
Encodes this structure to it's json representation
|
boolean |
isArray()
Checks if this structure is a
JsonArray |
boolean |
isObject()
Checks if this structure is
JsonObject |
abstract JsonArray |
values()
Returns the values contained in this structure as a
JsonArray |
public static final int ABSENT
public static final int OBJECT
public static final int ARRAY
public static final int STRING
public static final int BOOLEAN
public static final int NUMBER
public static final int NULL
public static JsonStructure decode(java.lang.String text)
JsonStructuretext - the string to decode cannot be nullJsonException - if the text cannot be parsed as json.public JsonArray asArray()
JsonArrayJsonArrayJsonException - if this structure is not a JsonArraypublic JsonObject asObject()
JsonObjectJsonObjectJsonException - if this structure is not a JsonObjectpublic abstract JsonStructure copy()
public abstract java.lang.String encode()
public final boolean isArray()
JsonArrayJsonArray false otherwisepublic final boolean isObject()
JsonObjectJsonObject false otherwisepublic abstract JsonArray values()
JsonArraypublic abstract JsonStructure clear()