Package groovy.json

# Enum Class JsonTokenType

java.lang.Object
java.lang.Enum<JsonTokenType>
groovy.json.JsonTokenType

All Implemented Interfaces:
  `Serializable`, `Comparable<JsonTokenType>`, `Constable`

public enum JsonTokenType extends Enum<JsonTokenType>
The original slurper and lexer use this class. This is kept around in case someone needs its exact behavior. Enum listing all the possible JSON tokens that should be recognized by the lexer.

Since:
  1.8.0

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class java.lang.Enum

  `Enum.EnumDesc<E extends Enum<E>>`

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `CLOSE_BRACKET`
  Closing square bracket token.
  `CLOSE_CURLY`
  Closing curly brace token.
  `COLON`
  Colon token.
  `COMMA`
  Comma token.
  `FALSE`
  `false` literal token.
  `NULL`
  `null` literal token.
  `NUMBER`
  Numeric literal token.
  `OPEN_BRACKET`
  Opening square bracket token.
  `OPEN_CURLY`
  Opening curly brace token.
  `STRING`
  String literal token.
  `TRUE`
  `true` literal token.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getLabel()`
  Returns the human-readable description of this token type.
  `Object`
  `getValidator()`
  Returns the validator used to recognize this token type.
  `boolean`
  `matching(String input)`
  Tells if an input string matches a token.
  `static JsonTokenType`
  `startingWith(char c)`
  Find which JSON value might be starting with a given character
  `static JsonTokenType`
  `valueOf(String name)`
  Returns the enum constant of this class with the specified name.
  `static JsonTokenType[]`
  `values()`
  Returns an array containing the constants of this enum class, in the order they are declared.

  ### Methods inherited from class java.lang.Enum

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### OPEN_CURLY

    public static final JsonTokenType OPEN_CURLY
    Opening curly brace token.

  - ### CLOSE_CURLY

    public static final JsonTokenType CLOSE_CURLY
    Closing curly brace token.

  - ### OPEN_BRACKET

    public static final JsonTokenType OPEN_BRACKET
    Opening square bracket token.

  - ### CLOSE_BRACKET

    public static final JsonTokenType CLOSE_BRACKET
    Closing square bracket token.

  - ### COLON

    public static final JsonTokenType COLON
    Colon token.

  - ### COMMA

    public static final JsonTokenType COMMA
    Comma token.

  - ### NULL

    public static final JsonTokenType NULL
    `null` literal token.

  - ### TRUE

    public static final JsonTokenType TRUE
    `true` literal token.

  - ### FALSE

    public static final JsonTokenType FALSE
    `false` literal token.

  - ### NUMBER

    public static final JsonTokenType NUMBER
    Numeric literal token.

  - ### STRING

    public static final JsonTokenType STRING
    String literal token.

    Original pattern throws the `StackOverflowError` for long strings with backslashes. It is therefore replaced by a 2-step approach inspired by json2.js sources: https://github.com/douglascrockford/JSON-js/blob/master/json2.js#L462 See JsonTokenTypeTest#testMatchingLongStringWithBackslashes() for details.

- ## Method Details

  - ### values

    public static JsonTokenType[] 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

    public static JsonTokenType valueOf(String name)
    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 name
      `NullPointerException` - if the argument is null

  - ### matching

    public boolean matching(String input)
    Tells if an input string matches a token.
    Parameters:
      `input` - the input string to match
    Returns:
      a `Matching` enum value: `YES` if this is an exact match, `POSSIBLE` if more characters could turn the input string into a valid token, or `NO` if the string cannot possibly match the pattern even with more characters to read.

  - ### startingWith

    public static JsonTokenType startingWith(char c)
    Find which JSON value might be starting with a given character
    Parameters:
      `c` - the character
    Returns:
      the possible token type found

  - ### getLabel

    public String getLabel()
    Returns the human-readable description of this token type.
    Returns:
      the token label

  - ### getValidator

    public Object getValidator()
    Returns the validator used to recognize this token type.
    Returns:
      the token validator