public abstract class DateTimeSerializerBase<T> extends StdScalarSerializer<T> implements ContextualSerializer
JsonSerializer.None
Modifier and Type | Method and Description |
---|---|
void |
acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor,
JavaType typeHint)
Default implementation specifies no format.
|
JsonSerializer<?> |
createContextual(SerializerProvider serializers,
BeanProperty property)
Method called to see if a different (or differently configured) serializer
is needed to serialize values of specified property.
|
JsonNode |
getSchema(SerializerProvider serializers,
java.lang.reflect.Type typeHint)
Default implementation simply claims type is "string"; usually
overriden by custom serializers.
|
boolean |
isEmpty(SerializerProvider serializers,
T value)
Method called to check whether given serializable value is
considered "empty" value (for purposes of suppressing serialization
of empty values).
|
abstract void |
serialize(T value,
JsonGenerator gen,
SerializerProvider serializers)
Method that can be called to ask implementation to serialize
values of type this serializer handles.
|
abstract DateTimeSerializerBase<T> |
withFormat(java.lang.Boolean timestamp,
java.text.DateFormat customFormat) |
serializeWithType
getSchema, handledType, wrapAndThrow, wrapAndThrow
getDelegatee, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterId
public abstract DateTimeSerializerBase<T> withFormat(java.lang.Boolean timestamp, java.text.DateFormat customFormat)
public JsonSerializer<?> createContextual(SerializerProvider serializers, BeanProperty property) throws JsonMappingException
ContextualSerializer
createContextual
in interface ContextualSerializer
serializers
- 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 boolean isEmpty(SerializerProvider serializers, T value)
JsonSerializer
Default implementation will consider only null values to be empty.
NOTE: replaces JsonSerializer.isEmpty(Object)
, which was deprecated in 2.5
isEmpty
in class JsonSerializer<T>
public JsonNode getSchema(SerializerProvider serializers, java.lang.reflect.Type typeHint)
StdSerializer
getSchema
in interface SchemaAware
getSchema
in class StdScalarSerializer<T>
serializers
- 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 StdScalarSerializer<T>
typeHint
- Type of element (entity like property) being visitedJsonMappingException
public abstract void serialize(T value, JsonGenerator gen, SerializerProvider serializers) throws java.io.IOException
JsonSerializer
serialize
in class StdSerializer<T>
value
- Value to serialize; can not be null.gen
- Generator used to output resulting Json contentserializers
- Provider that can be used to get serializers for
serializing Objects value contains, if any.java.io.IOException
Copyright © 2010 - 2020 Adobe. All Rights Reserved