Package groovy.json
Enum JsonTokenType
- java.lang.Object
- 
- java.lang.Enum<JsonTokenType>
- 
- groovy.json.JsonTokenType
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.lang.Comparable<JsonTokenType>
 
 public enum JsonTokenType extends java.lang.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
 
- 
- 
Enum Constant SummaryEnum Constants Enum Constant Description CLOSE_BRACKETCLOSE_CURLYCOLONCOMMAFALSENULLNUMBEROPEN_BRACKETOPEN_CURLYSTRINGOriginal pattern throws the StackOverflowError for long strings with backslashes.TRUE
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetLabel()java.lang.ObjectgetValidator()booleanmatching(java.lang.String input)Tells if an input string matches a token.static JsonTokenTypestartingWith(char c)Find which JSON value might be starting with a given characterstatic JsonTokenTypevalueOf(java.lang.String name)Returns 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 Detail- 
OPEN_CURLYpublic static final JsonTokenType OPEN_CURLY 
 - 
CLOSE_CURLYpublic static final JsonTokenType CLOSE_CURLY 
 - 
OPEN_BRACKETpublic static final JsonTokenType OPEN_BRACKET 
 - 
CLOSE_BRACKETpublic static final JsonTokenType CLOSE_BRACKET 
 - 
COLONpublic static final JsonTokenType COLON 
 - 
COMMApublic static final JsonTokenType COMMA 
 - 
NULLpublic static final JsonTokenType NULL 
 - 
TRUEpublic static final JsonTokenType TRUE 
 - 
FALSEpublic static final JsonTokenType FALSE 
 - 
NUMBERpublic static final JsonTokenType NUMBER 
 - 
STRINGpublic 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: https://github.com/douglascrockford/JSON-js/blob/master/json2.js#L462 See JsonTokenTypeTest#testMatchingLongStringWithBackslashes() for details.
 
- 
 - 
Method Detail- 
valuespublic 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()) System.out.println(c); - Returns:
- an array containing the constants of this enum type, in the order they are declared
 
 - 
valueOfpublic static JsonTokenType valueOf(java.lang.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:
- java.lang.IllegalArgumentException- if this enum type has no constant with the specified name
- java.lang.NullPointerException- if the argument is null
 
 - 
matchingpublic boolean matching(java.lang.String input) Tells 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.
 
 - 
startingWithpublic 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
 
 - 
getLabelpublic java.lang.String getLabel() 
 - 
getValidatorpublic java.lang.Object getValidator() 
 
- 
 
-