Package groovy.json

Enum JsonTokenType

  • All Implemented Interfaces:
    Serializable, Comparable<JsonTokenType>

    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.
    • Enum Constant Detail

      • STRING

        public static final JsonTokenType STRING
        Original pattern throws the StackOverflowError for long strings with backslashes. So it is replaced by a 2-step approach inspired from json2.js sources: See JsonTokenTypeTest#testMatchingLongStringWithBackslashes() for details.
    • Method Detail

      • values

        public static JsonTokenType[] 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 (JsonTokenType c : JsonTokenType.values())
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static JsonTokenType 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.)
        name - the name of the enum constant to be returned.
        the enum constant with the specified name
        IllegalArgumentException - if this enum type 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.
        input - the input string to match
        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
        c - the character
        the possible token type found
      • getLabel

        public String getLabel()
      • getValidator

        public Object getValidator()