public enum JsonToken extends Enum<JsonToken>
Enum Constant and Description |
---|
END_ARRAY
END_ARRAY is returned when encountering ']'
which signals ending of an Array value
|
END_OBJECT
END_OBJECT is returned when encountering '}'
which signals ending of an Object value
|
FIELD_NAME
FIELD_NAME is returned when a String token is encountered
as a field name (same lexical value, different function)
|
NOT_AVAILABLE
NOT_AVAILABLE can be returned if
JsonParser
implementation can not currently return the requested
token (usually next one), or even if any will be
available, but that may be able to determine this in
future. |
START_ARRAY
START_ARRAY is returned when encountering '['
which signals starting of an Array value
|
START_OBJECT
START_OBJECT is returned when encountering '{'
which signals starting of an Object value.
|
VALUE_EMBEDDED_OBJECT
Placeholder token returned when the input source has a concept
of embedded Object that are not accessible as usual structure
(of starting with
START_OBJECT , having values, ending with
END_OBJECT ), but as "raw" objects. |
VALUE_FALSE
VALUE_FALSE is returned when encountering literal "false" in
value context
|
VALUE_NULL
VALUE_NULL is returned when encountering literal "null" in
value context
|
VALUE_NUMBER_FLOAT
VALUE_NUMBER_INT is returned when a numeric token other
that is not an integer is encountered: that is, a number that does
have floating point or exponent marker in it, in addition
to one or more digits.
|
VALUE_NUMBER_INT
VALUE_NUMBER_INT is returned when an integer numeric token is
encountered in value context: that is, a number that does
not have floating point or exponent marker in it (consists
only of an optional sign, followed by one or more digits)
|
VALUE_STRING
VALUE_STRING is returned when a String token is encountered
in value context (array element, field value, or root-level
stand-alone value)
|
VALUE_TRUE
VALUE_TRUE is returned when encountering literal "true" in
value context
|
Modifier and Type | Method and Description |
---|---|
byte[] |
asByteArray() |
char[] |
asCharArray() |
String |
asString() |
int |
id() |
boolean |
isBoolean() |
boolean |
isNumeric() |
boolean |
isScalarValue()
Method that can be used to check whether this token represents
a valid non-structured value.
|
boolean |
isStructEnd()
Accessor that is functionally equivalent to:
this == JsonToken.END_OBJECT || this == JsonToken.END_ARRAY
|
boolean |
isStructStart()
Accessor that is functionally equivalent to:
this == JsonToken.START_OBJECT || this == JsonToken.START_ARRAY
|
static JsonToken |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static JsonToken[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final JsonToken NOT_AVAILABLE
JsonParser
implementation can not currently return the requested
token (usually next one), or even if any will be
available, but that may be able to determine this in
future. This is the case with non-blocking parsers --
they can not block to wait for more data to parse and
must return something.public static final JsonToken START_OBJECT
public static final JsonToken END_OBJECT
public static final JsonToken START_ARRAY
public static final JsonToken END_ARRAY
public static final JsonToken FIELD_NAME
public static final JsonToken VALUE_EMBEDDED_OBJECT
START_OBJECT
, having values, ending with
END_OBJECT
), but as "raw" objects.
Note: this token is never returned by regular JSON readers, but
only by readers that expose other kinds of source (like
JsonNode
-based JSON trees, Maps, Lists and such).
public static final JsonToken VALUE_STRING
public static final JsonToken VALUE_NUMBER_INT
public static final JsonToken VALUE_NUMBER_FLOAT
public static final JsonToken VALUE_TRUE
public static final JsonToken VALUE_FALSE
public static final JsonToken VALUE_NULL
public static JsonToken[] values()
for (JsonToken c : JsonToken.values()) System.out.println(c);
public static JsonToken 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 final int id()
public final String asString()
public final char[] asCharArray()
public final byte[] asByteArray()
public final boolean isNumeric()
public final boolean isStructStart()
this == JsonToken.START_OBJECT || this == JsonToken.START_ARRAY
public final boolean isStructEnd()
this == JsonToken.END_OBJECT || this == JsonToken.END_ARRAY
public final boolean isScalarValue()
public final boolean isBoolean()
Copyright © 2008-2015 FasterXML. All Rights Reserved.