public class OffsetDateTimeSerializer extends InstantSerializerBase<OffsetDateTime>
JsonSerializer.None
Modifier and Type | Field and Description |
---|---|
protected DateTimeFormatter |
_formatter
Specific format to use, if not default format: non null value
also indicates that serialization is to be done as JSON String,
not numeric timestamp, unless
_useTimestamp is true. |
protected JavaType |
_integerListType
Lazily constructed
JavaType representing type
List<Integer> . |
protected JsonFormat.Shape |
_shape |
protected Boolean |
_useNanoseconds
Flag that indicates that numeric timestamp values must be written using
nanosecond timestamps if the datatype supports such resolution,
regardless of other settings.
|
protected Boolean |
_useTimestamp
Flag that indicates that serialization must be done as the
Java timestamp, regardless of other settings.
|
static OffsetDateTimeSerializer |
INSTANCE |
_handledType
Modifier | Constructor and Description |
---|---|
protected |
OffsetDateTimeSerializer() |
protected |
OffsetDateTimeSerializer(OffsetDateTimeSerializer base,
Boolean useTimestamp,
Boolean useNanoseconds,
DateTimeFormatter formatter) |
protected |
OffsetDateTimeSerializer(OffsetDateTimeSerializer base,
Boolean useTimestamp,
DateTimeFormatter formatter) |
Modifier and Type | Method and Description |
---|---|
protected JavaType |
_integerListType(SerializerProvider prov) |
protected boolean |
_useTimestampExplicitOnly(SerializerProvider provider) |
void |
acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor,
JavaType typeHint)
Default implementation specifies no format.
|
JsonSerializer<?> |
createContextual(SerializerProvider prov,
BeanProperty property)
Method called to see if a different (or differently configured) serializer
is needed to serialize values of specified property.
|
JsonNode |
getSchema(SerializerProvider provider,
Type typeHint)
Default implementation simply claims type is "string"; usually
overriden by custom serializers.
|
protected SerializationFeature |
getTimestampsFeature()
Overridable method that determines
SerializationFeature that is used as
the global default in determining if date/time value serialized should use numeric
format ("timestamp") or not. |
void |
serializeWithType(T value,
JsonGenerator g,
SerializerProvider provider,
TypeSerializer typeSer)
Method that can be called to ask implementation to serialize
values of type this serializer handles, using specified type serializer
for embedding necessary type information.
|
protected boolean |
useNanoseconds(SerializerProvider provider) |
protected boolean |
useTimestamp(SerializerProvider provider) |
protected com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase<?> |
withFeatures(Boolean writeZoneId)
Deprecated.
|
protected com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase<?> |
withFeatures(Boolean writeZoneId,
Boolean writeNanoseconds) |
protected com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase<?> |
withFormat(Boolean useTimestamp,
DateTimeFormatter formatter,
JsonFormat.Shape shape) |
_acceptTimestampVisitor, serializationShape, serialize
_neitherNull, _nonEmpty, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrow
getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterId
public static final OffsetDateTimeSerializer INSTANCE
protected final Boolean _useTimestamp
protected final Boolean _useNanoseconds
protected final DateTimeFormatter _formatter
_useTimestamp
is true.protected final JsonFormat.Shape _shape
protected transient volatile JavaType _integerListType
JavaType
representing type
List<Integer>
.protected OffsetDateTimeSerializer()
protected OffsetDateTimeSerializer(OffsetDateTimeSerializer base, Boolean useTimestamp, DateTimeFormatter formatter)
protected OffsetDateTimeSerializer(OffsetDateTimeSerializer base, Boolean useTimestamp, Boolean useNanoseconds, DateTimeFormatter formatter)
protected com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase<?> withFormat(Boolean useTimestamp, DateTimeFormatter formatter, JsonFormat.Shape shape)
withFormat
in class InstantSerializerBase<OffsetDateTime>
protected com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase<?> withFeatures(Boolean writeZoneId, Boolean writeNanoseconds)
@Deprecated protected com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase<?> withFeatures(Boolean writeZoneId)
public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property) throws JsonMappingException
ContextualSerializer
createContextual
in interface ContextualSerializer
prov
- Serializer provider to use for accessing config, other serializersproperty
- Method or field that represents the property
(and is used to access value to serialize).
Should be available; but there may be cases where caller cannot provide it and
null is passed instead (in which case impls usually pass 'this' serializer as is)JsonMappingException
public JsonNode getSchema(SerializerProvider provider, Type typeHint)
StdSerializer
getSchema
in interface SchemaAware
getSchema
in class StdSerializer<T>
provider
- The serializer provider.typeHint
- A hint about the type.public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException
StdSerializer
acceptJsonFormatVisitor
in interface JsonFormatVisitable
acceptJsonFormatVisitor
in class StdSerializer<T>
typeHint
- Type of element (entity like property) being visitedJsonMappingException
protected JavaType _integerListType(SerializerProvider prov)
protected SerializationFeature getTimestampsFeature()
SerializationFeature
that is used as
the global default in determining if date/time value serialized should use numeric
format ("timestamp") or not.
Note that this feature is just the baseline setting and may be overridden on per-type or per-property basis.
protected boolean useTimestamp(SerializerProvider provider)
protected boolean _useTimestampExplicitOnly(SerializerProvider provider)
protected boolean useNanoseconds(SerializerProvider provider)
public void serializeWithType(T value, JsonGenerator g, SerializerProvider provider, TypeSerializer typeSer) throws IOException
JsonSerializer
Default implementation will throw UnsupportedOperationException
to indicate that proper type handling needs to be implemented.
For simple datatypes written as a single scalar value (JSON String, Number, Boolean), implementation would look like:
// note: method to call depends on whether this type is serialized as JSON scalar, object or Array! typeSer.writeTypePrefixForScalar(value, gen); serialize(value, gen, provider); typeSer.writeTypeSuffixForScalar(value, gen);and implementations for type serialized as JSON Arrays or Objects would differ slightly, as
START-ARRAY
/END-ARRAY
and
START-OBJECT
/END-OBJECT
pairs
need to be properly handled with respect to serializing of contents.serializeWithType
in class JsonSerializer<T>
value
- Value to serialize; can not be null.g
- Generator used to output resulting Json contentprovider
- Provider that can be used to get serializers for
serializing Objects value contains, if any.typeSer
- Type serializer to use for including type informationIOException
Copyright © 2020 JBoss by Red Hat. All rights reserved.