Package groovy.json
Enum JsonTokenType
- All Implemented Interfaces:
- Serializable,- Comparable<JsonTokenType>,- java.lang.constant.Constable
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 SummaryNested classes/interfaces inherited from class java.lang.EnumEnum.EnumDesc<E extends Enum<E>>
- 
Enum Constant SummaryEnum ConstantsEnum ConstantDescriptionOriginal pattern throws the StackOverflowError for long strings with backslashes.
- 
Method SummaryModifier and TypeMethodDescriptiongetLabel()booleanTells if an input string matches a token.static JsonTokenTypestartingWith(char c) Find which JSON value might be starting with a given characterstatic JsonTokenTypeReturns the enum constant of this type with the specified name.static JsonTokenType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
- 
Enum Constant Details- 
OPEN_CURLY
- 
CLOSE_CURLY
- 
OPEN_BRACKET
- 
CLOSE_BRACKET
- 
COLON
- 
COMMA
- 
NULL
- 
TRUE
- 
FALSE
- 
NUMBER
- 
STRINGOriginal pattern throws the StackOverflowError for long strings with backslashes. So it is replaced by a 2-step approach inspired from json2.js sources: https://github.com/douglascrockford/JSON-js/blob/master/json2.js#L462 See JsonTokenTypeTest#testMatchingLongStringWithBackslashes() for details.
 
- 
- 
Method Details- 
valuesReturns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
 
- 
valueOfReturns 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
 
- 
matchingTells if an input string matches a token.- Parameters:
- input- the input string to match
- Returns:
- a Matchingenum value:YESif this is an exact match,POSSIBLEif more characters could turn the input string into a valid token, orNOif the string cannot possibly match the pattern even with more characters to read.
 
- 
startingWithFind which JSON value might be starting with a given character- Parameters:
- c- the character
- Returns:
- the possible token type found
 
- 
getLabel
- 
getValidator
 
-