public class UUIDSerializer extends StdScalarSerializer<java.util.UUID> implements ContextualSerializer
JsonSerializer to output UUIDs.
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| Constructor and Description |
|---|
UUIDSerializer() |
| 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.
|
boolean |
isEmpty(SerializerProvider prov,
java.util.UUID value)
Method called to check whether given serializable value is
considered "empty" value (for purposes of suppressing serialization
of empty values).
|
void |
serialize(java.util.UUID value,
JsonGenerator gen,
SerializerProvider provider)
Method that can be called to ask implementation to serialize
values of type this serializer handles.
|
getSchema, serializeWithTypegetSchema, handledType, wrapAndThrow, wrapAndThrowgetDelegatee, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterIdpublic boolean isEmpty(SerializerProvider prov, java.util.UUID 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<java.util.UUID>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 cannot provide it and
null is passed instead (in which case impls usually pass 'this' serializer as is)JsonMappingExceptionpublic void serialize(java.util.UUID value,
JsonGenerator gen,
SerializerProvider provider)
throws java.io.IOException
JsonSerializerserialize in class StdSerializer<java.util.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.java.io.IOExceptionpublic void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException
StdSerializeracceptJsonFormatVisitor in interface JsonFormatVisitableacceptJsonFormatVisitor in class StdScalarSerializer<java.util.UUID>typeHint - Type of element (entity like property) being visitedJsonMappingExceptionCopyright © 2010 - 2023 Adobe. All Rights Reserved