Common uses include choosing between alternate representations -- for example,
whether java. is to be serialized as number (Java timestamp)
or String (such as ISO-8601 compatible time value) -- as well as configuring
exact details with pattern property.
As of Jackson 2.6, known special handling includes:
java.util.Date : Shape can be Shape#STRING or Shape#NUMBER;
pattern may contain java.text.SimpleDateFormat -compatible pattern definition.
java.lang.Enum s: Shapes Shape#STRING and Shape#NUMBER can be
used to change between numeric (index) and textual (name or toString());
but it is also possible to use Shape#OBJECT to serialize (but not deserialize)
java.lang.Enum s as JSON Objects (as if they were POJOs). NOTE: serialization
as JSON Object only works with class annotation;
will not work as per-property annotation.
java.util.Collection s can be serialized as (and deserialized from) JSON Objects,
if Shape#OBJECT is used. NOTE: can ONLY be used as class annotation;
will not work as per-property annotation.
java.lang.Number subclasses can be serialized as full objects if
Shape#OBJECT is used. Otherwise the default behavior of serializing to a
scalar number value will be preferred. NOTE: can ONLY be used as class annotation;
will not work as per-property annotation.
| Modifier and Type | Class and Description |
|---|---|
| public static enum | JsonFormat.
Set of features that can be enabled/disabled for property annotated. |
| public static class | JsonFormat.
Helper class that encapsulates information equivalent to |
| public static enum | JsonFormat.
Value enumeration used for indicating preferred Shape; translates loosely to JSON types, with some extra values to indicate less precise choices (i.e. allowing one of multiple actual shapes) |
| public static class | JsonFormat.
Helper class used to contain information from a single |
| Modifier and Type | Field and Description |
|---|---|
| public static final String | DEFAULT_LOCALE
Value that indicates that default |
| public static final String | DEFAULT_TIMEZONE
Value that indicates that default |
| Modifier and Type | Method and Description |
|---|---|
| public OptBoolean | |
| public String | |
| public String | pattern()
Datatype-specific additional piece of configuration that may be used to further refine formatting aspects. |
| public JsonFormat. | shape()
Structure to use for serialization: definition of mapping depends on datatype, but usually has straight-forward counterpart in data format (JSON). |
| public String | |
| public JsonFormat. | with()
Set of |
| public JsonFormat. | without()
Set of |