public static enum JsonValue.EntityType extends Enum<JsonValue.EntityType>
Note that the entity type may not be equivalent to the value type as JSON. For example, both 42
and
3.141592
are typed as just "numbers" as JSON. As JsonValue
, however, they are normally represented
by different implementation classes, and then typed as different entity types. 42
is usually represented by
JsonLong
as JsonLong.of(42)
, then typed as LONG
. 3.141592
is
represented by JsonDouble
as JsonDouble.of(3.141592)
, then typed as DOUBLE
.
Enum Constant and Description |
---|
ARRAY
The singleton instance of the entity type for arrays in JSON, which is represented by
JsonArray . |
BOOLEAN
The singleton instance of the entity type for
true or false in JSON, which is represented by JsonBoolean . |
DOUBLE
The singleton instance of the entity type for numbers in JSON, which is represented by
JsonDouble . |
LONG
The singleton instance of the entity type for integral numbers in JSON, which is represented by
JsonLong . |
NULL
The singleton instance of the entity type for
null in JSON, which is represented by JsonNull . |
OBJECT
The singleton instance of the entity type for objects in JSON, which is represented by
JsonObject . |
STRING
The singleton instance of the entity type for strings in JSON, which is represented by
JsonString . |
Modifier and Type | Method and Description |
---|---|
boolean |
isArray()
Returns
true if the JSON value is an array, which is represented by JsonArray . |
boolean |
isBoolean()
|
boolean |
isDouble()
Returns
true if the JSON value is a number, which is represented by JsonDouble . |
boolean |
isLong()
Returns
true if the JSON value is an integral number, which is represented by JsonLong . |
boolean |
isNull()
|
boolean |
isObject()
Returns
true if the JSON value is an object, which is represented by JsonObject . |
boolean |
isString()
Returns
true if the JSON value is a string, which is represented by JsonString . |
static JsonValue.EntityType |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static JsonValue.EntityType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final JsonValue.EntityType NULL
null
in JSON, which is represented by JsonNull
.public static final JsonValue.EntityType BOOLEAN
true
or false
in JSON, which is represented by JsonBoolean
.public static final JsonValue.EntityType LONG
JsonLong
.public static final JsonValue.EntityType DOUBLE
JsonDouble
.public static final JsonValue.EntityType STRING
JsonString
.public static final JsonValue.EntityType ARRAY
JsonArray
.public static final JsonValue.EntityType OBJECT
JsonObject
.public static JsonValue.EntityType[] values()
for (JsonValue.EntityType c : JsonValue.EntityType.values()) System.out.println(c);
public static JsonValue.EntityType valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic boolean isNull()
public boolean isBoolean()
public boolean isLong()
true
if the JSON value is an integral number, which is represented by JsonLong
.public boolean isDouble()
true
if the JSON value is a number, which is represented by JsonDouble
.public boolean isString()
true
if the JSON value is a string, which is represented by JsonString
.public boolean isArray()
true
if the JSON value is an array, which is represented by JsonArray
.public boolean isObject()
true
if the JSON value is an object, which is represented by JsonObject
.