Class JSR310FormattedSerializerBase<T>
- java.lang.Object
-
- com.fasterxml.jackson.databind.JsonSerializer<T>
-
- com.fasterxml.jackson.databind.ser.std.StdSerializer<T>
-
- com.fasterxml.jackson.datatype.jsr310.ser.JSR310SerializerBase<T>
-
- com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase<T>
-
- All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
,com.fasterxml.jackson.databind.jsonschema.SchemaAware
,com.fasterxml.jackson.databind.ser.ContextualSerializer
,java.io.Serializable
- Direct Known Subclasses:
DurationSerializer
,InstantSerializerBase
,LocalDateSerializer
,LocalDateTimeSerializer
,LocalTimeSerializer
,MonthDaySerializer
,OffsetTimeSerializer
,YearMonthSerializer
,YearSerializer
abstract class JSR310FormattedSerializerBase<T> extends JSR310SerializerBase<T> implements com.fasterxml.jackson.databind.ser.ContextualSerializer
Base class that provides an array schema instead of scalar schema ifSerializationFeature.WRITE_DATES_AS_TIMESTAMPS
is enabled.- Since:
- 2.2
-
-
Field Summary
Fields Modifier and Type Field Description protected java.time.format.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 com.fasterxml.jackson.databind.JavaType
_integerListType
Lazily constructedJavaType
representing typeList<Integer>
.protected com.fasterxml.jackson.annotation.JsonFormat.Shape
_shape
protected java.lang.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 java.lang.Boolean
_useTimestamp
Flag that indicates that serialization must be done as the Java timestamp, regardless of other settings.private static long
serialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description protected
JSR310FormattedSerializerBase(JSR310FormattedSerializerBase<?> base, java.lang.Boolean useTimestamp, java.lang.Boolean useNanoseconds, java.time.format.DateTimeFormatter dtf, com.fasterxml.jackson.annotation.JsonFormat.Shape shape)
protected
JSR310FormattedSerializerBase(JSR310FormattedSerializerBase<?> base, java.lang.Boolean useTimestamp, java.time.format.DateTimeFormatter dtf, com.fasterxml.jackson.annotation.JsonFormat.Shape shape)
protected
JSR310FormattedSerializerBase(java.lang.Class<T> supportedType)
protected
JSR310FormattedSerializerBase(java.lang.Class<T> supportedType, java.time.format.DateTimeFormatter formatter)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
_acceptTimestampVisitor(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper visitor, com.fasterxml.jackson.databind.JavaType typeHint)
protected com.fasterxml.jackson.databind.JavaType
_integerListType(com.fasterxml.jackson.databind.SerializerProvider prov)
protected java.time.format.DateTimeFormatter
_useDateTimeFormatter(com.fasterxml.jackson.databind.SerializerProvider prov, com.fasterxml.jackson.annotation.JsonFormat.Value format)
protected boolean
_useTimestampExplicitOnly(com.fasterxml.jackson.databind.SerializerProvider provider)
void
acceptJsonFormatVisitor(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper visitor, com.fasterxml.jackson.databind.JavaType typeHint)
com.fasterxml.jackson.databind.JsonSerializer<?>
createContextual(com.fasterxml.jackson.databind.SerializerProvider prov, com.fasterxml.jackson.databind.BeanProperty property)
com.fasterxml.jackson.databind.JsonNode
getSchema(com.fasterxml.jackson.databind.SerializerProvider provider, java.lang.reflect.Type typeHint)
Deprecated.Since 2.15protected com.fasterxml.jackson.databind.SerializationFeature
getTimestampsFeature()
Overridable method that determinesSerializationFeature
that is used as the global default in determining if date/time value serialized should use numeric format ("timestamp") or not.protected boolean
useNanoseconds(com.fasterxml.jackson.databind.SerializerProvider provider)
protected boolean
useTimestamp(com.fasterxml.jackson.databind.SerializerProvider provider)
protected JSR310FormattedSerializerBase<?>
withFeatures(java.lang.Boolean writeZoneId)
Deprecated.protected JSR310FormattedSerializerBase<?>
withFeatures(java.lang.Boolean writeZoneId, java.lang.Boolean writeNanoseconds)
protected abstract JSR310FormattedSerializerBase<?>
withFormat(java.lang.Boolean useTimestamp, java.time.format.DateTimeFormatter dtf, com.fasterxml.jackson.annotation.JsonFormat.Shape shape)
-
Methods inherited from class com.fasterxml.jackson.datatype.jsr310.ser.JSR310SerializerBase
serializationShape, serializeWithType
-
Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
_neitherNull, _nonEmpty, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, handledType, isDefaultSerializer, serialize, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrow
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
_useTimestamp
protected final java.lang.Boolean _useTimestamp
Flag that indicates that serialization must be done as the Java timestamp, regardless of other settings.
-
_useNanoseconds
protected final java.lang.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.
-
_formatter
protected final java.time.format.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.
-
_shape
protected final com.fasterxml.jackson.annotation.JsonFormat.Shape _shape
-
_integerListType
protected transient volatile com.fasterxml.jackson.databind.JavaType _integerListType
Lazily constructedJavaType
representing typeList<Integer>
.- Since:
- 2.10
-
-
Constructor Detail
-
JSR310FormattedSerializerBase
protected JSR310FormattedSerializerBase(java.lang.Class<T> supportedType)
-
JSR310FormattedSerializerBase
protected JSR310FormattedSerializerBase(java.lang.Class<T> supportedType, java.time.format.DateTimeFormatter formatter)
-
JSR310FormattedSerializerBase
protected JSR310FormattedSerializerBase(JSR310FormattedSerializerBase<?> base, java.lang.Boolean useTimestamp, java.time.format.DateTimeFormatter dtf, com.fasterxml.jackson.annotation.JsonFormat.Shape shape)
-
JSR310FormattedSerializerBase
protected JSR310FormattedSerializerBase(JSR310FormattedSerializerBase<?> base, java.lang.Boolean useTimestamp, java.lang.Boolean useNanoseconds, java.time.format.DateTimeFormatter dtf, com.fasterxml.jackson.annotation.JsonFormat.Shape shape)
-
-
Method Detail
-
withFormat
protected abstract JSR310FormattedSerializerBase<?> withFormat(java.lang.Boolean useTimestamp, java.time.format.DateTimeFormatter dtf, com.fasterxml.jackson.annotation.JsonFormat.Shape shape)
-
withFeatures
@Deprecated protected JSR310FormattedSerializerBase<?> withFeatures(java.lang.Boolean writeZoneId)
Deprecated.- Since:
- 2.8
-
withFeatures
protected JSR310FormattedSerializerBase<?> withFeatures(java.lang.Boolean writeZoneId, java.lang.Boolean writeNanoseconds)
- Since:
- 2.9.5
-
createContextual
public com.fasterxml.jackson.databind.JsonSerializer<?> createContextual(com.fasterxml.jackson.databind.SerializerProvider prov, com.fasterxml.jackson.databind.BeanProperty property) throws com.fasterxml.jackson.databind.JsonMappingException
- Specified by:
createContextual
in interfacecom.fasterxml.jackson.databind.ser.ContextualSerializer
- Throws:
com.fasterxml.jackson.databind.JsonMappingException
-
getSchema
@Deprecated public com.fasterxml.jackson.databind.JsonNode getSchema(com.fasterxml.jackson.databind.SerializerProvider provider, java.lang.reflect.Type typeHint)
Deprecated.Since 2.15- Specified by:
getSchema
in interfacecom.fasterxml.jackson.databind.jsonschema.SchemaAware
- Overrides:
getSchema
in classcom.fasterxml.jackson.databind.ser.std.StdSerializer<T>
-
acceptJsonFormatVisitor
public void acceptJsonFormatVisitor(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper visitor, com.fasterxml.jackson.databind.JavaType typeHint) throws com.fasterxml.jackson.databind.JsonMappingException
- Specified by:
acceptJsonFormatVisitor
in interfacecom.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
- Overrides:
acceptJsonFormatVisitor
in classcom.fasterxml.jackson.databind.ser.std.StdSerializer<T>
- Throws:
com.fasterxml.jackson.databind.JsonMappingException
-
_acceptTimestampVisitor
protected void _acceptTimestampVisitor(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper visitor, com.fasterxml.jackson.databind.JavaType typeHint) throws com.fasterxml.jackson.databind.JsonMappingException
- Throws:
com.fasterxml.jackson.databind.JsonMappingException
-
_integerListType
protected com.fasterxml.jackson.databind.JavaType _integerListType(com.fasterxml.jackson.databind.SerializerProvider prov)
-
getTimestampsFeature
protected com.fasterxml.jackson.databind.SerializationFeature getTimestampsFeature()
Overridable method that determinesSerializationFeature
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.
- Since:
- 2.10
-
useTimestamp
protected boolean useTimestamp(com.fasterxml.jackson.databind.SerializerProvider provider)
-
_useTimestampExplicitOnly
protected boolean _useTimestampExplicitOnly(com.fasterxml.jackson.databind.SerializerProvider provider)
-
useNanoseconds
protected boolean useNanoseconds(com.fasterxml.jackson.databind.SerializerProvider provider)
-
_useDateTimeFormatter
protected java.time.format.DateTimeFormatter _useDateTimeFormatter(com.fasterxml.jackson.databind.SerializerProvider prov, com.fasterxml.jackson.annotation.JsonFormat.Value format)
-
-