Package org.codehaus.jackson
Enum Class JsonToken
- All Implemented Interfaces:
Serializable
,Comparable<JsonToken>
,Constable
Enumeration for basic token types used for returning results
of parsing JSON content.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionSTART_OBJECT is returned when encountering ']' which signals ending of an Array valueSTART_OBJECT is returned when encountering '}' which signals ending of an Object valueFIELD_NAME is returned when a String token is encountered as a field name (same lexical value, different function)NOT_AVAILABLE can be returned ifJsonParser
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_OBJECT is returned when encountering '[' which signals starting of an Array valueSTART_OBJECT is returned when encountering '{' which signals starting of an Object value.Placeholder token returned when the input source has a concept of embedded Object that are not accessible as usual structure (of starting withSTART_OBJECT
, having values, ending withEND_OBJECT
), but as "raw" objects.VALUE_FALSE is returned when encountering literal "false" in value contextVALUE_NULL is returned when encountering literal "null" in value contextVALUE_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 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 is returned when a String token is encountered in value context (array element, field value, or root-level stand-alone value)VALUE_TRUE is returned when encountering literal "true" in value context -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
char[]
asString()
boolean
boolean
Method that can be used to check whether this token represents a valid non-structured value.static JsonToken
Returns the enum constant of this class with the specified name.static JsonToken[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NOT_AVAILABLE
NOT_AVAILABLE can be returned ifJsonParser
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.- Since:
- 0.9.7
-
START_OBJECT
START_OBJECT is returned when encountering '{' which signals starting of an Object value. -
END_OBJECT
START_OBJECT is returned when encountering '}' which signals ending of an Object value -
START_ARRAY
START_OBJECT is returned when encountering '[' which signals starting of an Array value -
END_ARRAY
START_OBJECT is returned when encountering ']' which signals ending of an Array value -
FIELD_NAME
FIELD_NAME is returned when a String token is encountered as a field name (same lexical value, different function) -
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 withSTART_OBJECT
, having values, ending withEND_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).- Since:
- 1.1
-
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_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_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_TRUE
VALUE_TRUE is returned when encountering literal "true" in value context -
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
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
asString
-
asCharArray
public char[] asCharArray() -
asByteArray
public byte[] asByteArray() -
isNumeric
public boolean isNumeric() -
isScalarValue
public boolean isScalarValue()Method that can be used to check whether this token represents a valid non-structured value. This means all tokens other than Object/Array start/end markers all field names.
-