-
- All Known Subinterfaces:
JsonArray
,JsonNumber
,JsonObject
,JsonString
,JsonStructure
public interface JsonValue
JsonValue
represents an immutable JSON value.A JSON value is one of the following: an object (
JsonObject
), an array (JsonArray
), a number (JsonNumber
), a string (JsonString
),true
(JsonValue.TRUE
),false
(JsonValue.FALSE
), ornull
(JsonValue.NULL
).
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
JsonValue.ValueType
Indicates the type of aJsonValue
object.
-
Field Summary
Fields Modifier and Type Field Description static JsonArray
EMPTY_JSON_ARRAY
The empty JSON array.static JsonObject
EMPTY_JSON_OBJECT
The empty JSON object.static JsonValue
FALSE
JSON false value.static JsonValue
NULL
JSON null value.static JsonValue
TRUE
JSON true value.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default JsonArray
asJsonArray()
Return the JsonValue as a JsonArraydefault JsonObject
asJsonObject()
Return the JsonValue as a JsonObjectJsonValue.ValueType
getValueType()
Returns the value type of this JSON value.String
toString()
Returns JSON text for this JSON value.
-
-
-
Field Detail
-
EMPTY_JSON_OBJECT
static final JsonObject EMPTY_JSON_OBJECT
The empty JSON object.- Since:
- 1.1
-
EMPTY_JSON_ARRAY
static final JsonArray EMPTY_JSON_ARRAY
The empty JSON array.- Since:
- 1.1
-
NULL
static final JsonValue NULL
JSON null value.
-
TRUE
static final JsonValue TRUE
JSON true value.
-
FALSE
static final JsonValue FALSE
JSON false value.
-
-
Method Detail
-
getValueType
JsonValue.ValueType getValueType()
Returns the value type of this JSON value.- Returns:
- JSON value type
-
asJsonObject
default JsonObject asJsonObject()
Return the JsonValue as a JsonObject- Returns:
- the JsonValue as a JsonObject
- Throws:
ClassCastException
- if the JsonValue is not a JsonObject- Since:
- 1.1
-
asJsonArray
default JsonArray asJsonArray()
Return the JsonValue as a JsonArray- Returns:
- the JsonValue as a JsonArray
- Throws:
ClassCastException
- if the JsonValue is not a JsonArray- Since:
- 1.1
-
-