public abstract class DateTimeSerializerBase<T> extends StdScalarSerializer<T> implements ContextualSerializer
JsonSerializer.None| Modifier and Type | Field and Description |
|---|---|
protected DateFormat |
_customFormat
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 Boolean |
_useTimestamp
Flag that indicates that serialization must be done as the
Java timestamp, regardless of other settings.
|
_handledType| Modifier | Constructor and Description |
|---|---|
protected |
DateTimeSerializerBase(Class<T> type,
Boolean useTimestamp,
DateFormat customFormat) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
_acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor,
JavaType typeHint,
boolean asNumber) |
protected boolean |
_asTimestamp(SerializerProvider serializers) |
protected abstract long |
_timestamp(T value) |
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,
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).
|
boolean |
isEmpty(T value)
Deprecated.
|
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(Boolean timestamp,
DateFormat customFormat) |
serializeWithTypecreateObjectNode, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrowgetDelegatee, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterIdprotected final Boolean _useTimestamp
protected final DateFormat _customFormat
_useTimestamp is true.protected DateTimeSerializerBase(Class<T> type, Boolean useTimestamp, DateFormat customFormat)
public abstract DateTimeSerializerBase<T> withFormat(Boolean timestamp, DateFormat customFormat)
public JsonSerializer<?> createContextual(SerializerProvider serializers, BeanProperty property) throws JsonMappingException
ContextualSerializercreateContextual in interface ContextualSerializerserializers - 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 can not provide it and
null is passed instead (in which case impls usually pass 'this' serializer as is)JsonMappingException@Deprecated public boolean isEmpty(T value)
JsonSerializerDefault implementation will consider only null values to be empty.
isEmpty in class JsonSerializer<T>public boolean isEmpty(SerializerProvider serializers, T value)
JsonSerializerDefault 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>protected abstract long _timestamp(T value)
public JsonNode getSchema(SerializerProvider serializers, Type typeHint)
StdSerializergetSchema in interface SchemaAwaregetSchema in class StdScalarSerializer<T>serializers - The serializer provider.typeHint - A hint about the type.public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException
StdSerializeracceptJsonFormatVisitor in interface JsonFormatVisitableacceptJsonFormatVisitor in class StdScalarSerializer<T>typeHint - Type of element (entity like property) being visitedJsonMappingExceptionpublic abstract void serialize(T value, JsonGenerator gen, SerializerProvider serializers) throws IOException
JsonSerializerserialize 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.IOExceptionprotected boolean _asTimestamp(SerializerProvider serializers)
protected void _acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint, boolean asNumber) throws JsonMappingException
JsonMappingExceptionCopyright © 2017 JBoss by Red Hat. All rights reserved.