public class UUIDSerializer extends StdScalarSerializer<UUID> implements ContextualSerializer
JsonSerializer
to output UUID
s.
Beyond optimized access and writing of textual representation (which
is the default handling in most cases), it will alternatively
allow serialization using raw binary output (as 16-byte block)
if underlying data format has efficient means to access that.JsonSerializer.None
Modifier and Type | Field and Description |
---|---|
protected Boolean |
_asBinary
Configuration setting that indicates if serialization as binary
(native or Base64-encoded) has been forced;
null means
"use default heuristic" |
_handledType
Modifier | Constructor and Description |
---|---|
|
UUIDSerializer() |
protected |
UUIDSerializer(Boolean asBinary) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
_writeAsBinary(com.fasterxml.jackson.core.JsonGenerator g) |
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.
|
boolean |
isEmpty(SerializerProvider prov,
UUID value)
Method called to check whether given serializable value is
considered "empty" value (for purposes of suppressing serialization
of empty values).
|
void |
serialize(UUID value,
com.fasterxml.jackson.core.JsonGenerator gen,
SerializerProvider provider)
Method that can be called to ask implementation to serialize
values of type this serializer handles.
|
getSchema, serializeWithType
_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, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterId
protected final Boolean _asBinary
null
means
"use default heuristic"public UUIDSerializer()
protected UUIDSerializer(Boolean asBinary)
public boolean isEmpty(SerializerProvider prov, UUID 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<UUID>
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 void serialize(UUID value, com.fasterxml.jackson.core.JsonGenerator gen, SerializerProvider provider) throws IOException
JsonSerializer
serialize
in class StdSerializer<UUID>
value
- Value to serialize; can not be null.gen
- Generator used to output resulting Json contentprovider
- Provider that can be used to get serializers for
serializing Objects value contains, if any.IOException
protected boolean _writeAsBinary(com.fasterxml.jackson.core.JsonGenerator g)
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException
StdSerializer
acceptJsonFormatVisitor
in interface JsonFormatVisitable
acceptJsonFormatVisitor
in class StdScalarSerializer<UUID>
typeHint
- Type of element (entity like property) being visitedJsonMappingException
Copyright © 2008–2022 FasterXML. All rights reserved.