Class JsonValues
Conversions the generated @Mapped mappers share: the lenient readers for
@JsonFormat fields, ISO-8601 dates computed by arithmetic, and the path
prefixing of a nested failure. Called only from generated code.
Nothing here consults a locale or a time zone: neither is guaranteed on a device, and a wire format must not depend on the phone's settings. Dates are always written in UTC.
-
Method Summary
Modifier and TypeMethodDescriptionstatic IllegalArgumentExceptionat(String path, IllegalArgumentException e) Prefixes a nested failure with the location it happened at.static StringFormatsdasyyyy-MM-ddTHH:mm:ss.SSSZin UTC.static Objectjsonread bymapper, which must be a JSON object.static longParses an ISO-8601 date or date-time to epoch milliseconds.static DateA JSON date in either shape: epoch milliseconds (a number or a numeric string) or an ISO-8601 string -- a date alone, or a date and time with optional fraction andZor numeric offset.static doubleA JSON number, or a string holding one, as adouble.static longtoIntegral(Object v, long min, long max) A JSON whole number in[min, max], for an array element of an integral type: a fraction or a value out of range is refused rather than truncated, as the server's codec refuses it.static longA JSON number, or a string holding one, as along.
-
Method Details
-
toLong
A JSON number, or a string holding one, as a
long.Throws
IllegalArgumentException: when the value is neither
-
toIntegral
A JSON whole number in
[min, max], for an array element of an integral type: a fraction or a value out of range is refused rather than truncated, as the server's codec refuses it.Throws
IllegalArgumentException: when the value is not such a number
-
object
-
toDouble
A JSON number, or a string holding one, as a
double.Throws
IllegalArgumentException: when the value is neither
-
toDate
-
formatIso
-
parseIso
Parses an ISO-8601 date or date-time to epoch milliseconds. A value with no offset is read as UTC.
Throws
IllegalArgumentException: whensis not ISO-8601
-
at
Prefixes a nested failure with the location it happened at. A message that already starts with a$path is joined to it, so a failure three levels down reads$.order.items[2].due: required member is missing.
-