Package javax.json
Interface JsonValue
-
- All Known Subinterfaces:
JsonArray
,JsonNumber
,JsonObject
,JsonString
,JsonStructure
public interface JsonValue
JsonValue
represents an immutable JSON value.
This is a near-exact copy of the same-titled Java EE 8 Class:javax.json.JsonValue
Commenting has been slightly modified to accompany HiLiting the Code Examples.
Java Source Code remains identical to the Sun-Oracle & 'GlassFish' Released Distributions.
Read included License:HERE
, and theCDDL+GPL-1.1
Alljavax.json.*
Code Obtained From:GitHub JavaEE jsonp
Public Archive.
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
)null
(JsonValue.NULL
)
Hi-Lited Source-Code:This File's Source Code:
- View Here: javax/json/JsonValue.java
- Open New Browser-Tab: javax/json/JsonValue.java
File Size: 4,624 Bytes Line Count: 170 '\n' Characters Found
javax.json Implementation:
- View Here: /java/javax/json/JsonValueImpl.java
- Open New Browser-Tab: /java/javax/json/JsonValueImpl.java
File Size: 3,807 Bytes Line Count: 109 '\n' Characters Found
-
-
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
- Code:
- Exact Field Declaration Expression:
static final JsonObject EMPTY_JSON_OBJECT = new EmptyObject();
-
EMPTY_JSON_ARRAY
static final JsonArray EMPTY_JSON_ARRAY
The empty JSON array.- Since:
- 1.1
- Code:
- Exact Field Declaration Expression:
static final JsonArray EMPTY_JSON_ARRAY = new EmptyArray();
-
NULL
-
TRUE
-
FALSE
-
-
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:
java.lang.ClassCastException
- if the JsonValue is not a JsonObject- Since:
- 1.1
- Code:
- Exact Method Body:
return JsonObject.class.cast(this);
-
asJsonArray
default JsonArray asJsonArray()
Return the JsonValue as a JsonArray- Returns:
- the JsonValue as a JsonArray
- Throws:
java.lang.ClassCastException
- if the JsonValue is not a JsonArray- Since:
- 1.1
- Code:
- Exact Method Body:
return JsonArray.class.cast(this);
-
toString
java.lang.String toString()
Returns JSON text for this JSON value.- Overrides:
toString
in classjava.lang.Object
- Returns:
- JSON text
-
-