public class InstantSerializer extends InstantSerializerBase<Instant>
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 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 InstantSerializer |
INSTANCE |
_handledType| Modifier | Constructor and Description |
|---|---|
protected |
InstantSerializer() |
protected |
InstantSerializer(InstantSerializer base,
Boolean useTimestamp,
Boolean useNanoseconds,
DateTimeFormatter formatter) |
protected |
InstantSerializer(InstantSerializer base,
Boolean useTimestamp,
DateTimeFormatter formatter) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
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<Instant> |
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, wrapAndThrowgetDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterIdpublic static final InstantSerializer INSTANCE
protected final Boolean _useTimestamp
protected final Boolean _useNanoseconds
protected final DateTimeFormatter _formatter
_useTimestamp is true.protected final JsonFormat.Shape _shape
protected InstantSerializer()
protected InstantSerializer(InstantSerializer base, Boolean useTimestamp, DateTimeFormatter formatter)
protected InstantSerializer(InstantSerializer base, Boolean useTimestamp, Boolean useNanoseconds, DateTimeFormatter formatter)
protected com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase<Instant> withFormat(Boolean useTimestamp, DateTimeFormatter formatter, JsonFormat.Shape shape)
withFormat in class InstantSerializerBase<Instant>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
ContextualSerializercreateContextual in interface ContextualSerializerprov - 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)JsonMappingExceptionpublic JsonNode getSchema(SerializerProvider provider, Type typeHint)
StdSerializergetSchema in interface SchemaAwaregetSchema in class StdSerializer<T>provider - The serializer provider.typeHint - A hint about the type.public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException
StdSerializeracceptJsonFormatVisitor in interface JsonFormatVisitableacceptJsonFormatVisitor in class StdSerializer<T>typeHint - Type of element (entity like property) being visitedJsonMappingExceptionprotected 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 informationIOExceptionCopyright © 2018 JBoss by Red Hat. All rights reserved.