JSON
Version 1.0

org.codehaus.jackson
Enum JsonToken

java.lang.Object
  extended by java.lang.Enum<JsonToken>
      extended by org.codehaus.jackson.JsonToken
All Implemented Interfaces:
Serializable, Comparable<JsonToken>

public enum JsonToken
extends Enum<JsonToken>

This enumeration defines basic token types that are results of parsing JSON content.


Enum Constant Summary
END_ARRAY
          START_OBJECT is returned when encountering ']' which signals ending of an Array value
END_OBJECT
          START_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)
START_ARRAY
          START_OBJECT 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_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
 
Method Summary
 char[] asCharArray()
           
 String asString()
           
 boolean isNumeric()
           
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.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

START_OBJECT

public static final JsonToken START_OBJECT
START_OBJECT is returned when encountering '{' which signals starting of an Object value


END_OBJECT

public static final JsonToken END_OBJECT
START_OBJECT is returned when encountering '}' which signals ending of an Object value


START_ARRAY

public static final JsonToken START_ARRAY
START_OBJECT is returned when encountering '[' which signals starting of an Array value


END_ARRAY

public static final JsonToken END_ARRAY
START_OBJECT is returned when encountering ']' which signals ending of an Array value


FIELD_NAME

public static final JsonToken FIELD_NAME
FIELD_NAME is returned when a String token is encountered as a field name (same lexical value, different function)


VALUE_STRING

public static final JsonToken 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

public static final JsonToken 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

public static final JsonToken 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

public static final JsonToken VALUE_TRUE
VALUE_TRUE is returned when encountering literal "true" in value context


VALUE_FALSE

public static final JsonToken VALUE_FALSE
VALUE_FALSE is returned when encountering literal "false" in value context


VALUE_NULL

public static final JsonToken VALUE_NULL
VALUE_NULL is returned when encountering literal "null" in value context

Method Detail

values

public static JsonToken[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (JsonToken c : JsonToken.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static JsonToken valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
NullPointerException - if the argument is null

asString

public String asString()

asCharArray

public char[] asCharArray()

isNumeric

public boolean isNumeric()

JSON
Version 1.0

Apache License, Version 2.0