Package groovy.json
Enum Class JsonDateHandling
- All Implemented Interfaces:
Serializable,Comparable<JsonDateHandling>,Constable
What a slurper makes of a string in a full ISO-8601 or JSON-date form.
This applies to JsonParserType.INDEX_OVERLAY and JsonParserType.LAX.
The other two parser types have no date handling and return the string whatever is
chosen here. A date carrying no time, such as "2026-09-04", is left as a
String by every parser type.
- Since:
- 6.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionConvert to aOffsetDateTime, the only choice here that keeps the offset the document carried.Leave it as aString, as it appears in the document.Convert to aDate. -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonDateHandlingReturns the enum constant of this class with the specified name.static JsonDateHandling[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
STRING
Leave it as aString, as it appears in the document. -
UTIL_DATE
Convert to aDate. This is the default, and what a slurper has always done. ADateis an instant, so an offset in the source is not preserved. -
INSTANT
-
OFFSET_DATE_TIME
Convert to aOffsetDateTime, the only choice here that keeps the offset the document carried.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-