Top Description Fields Constructors Methods
com.fasterxml.jackson.databind.ser.std

public Class UUIDSerializer

extends StdScalarSerializer<UUID>
implements ContextualSerializer
Class Inheritance
All Implemented Interfaces
com.fasterxml.jackson.databind.ser.ContextualSerializer
Annotations
@SuppressWarnings:serial
Imports
java.io.IOException, java.util.Objects, .UUID, com.fasterxml.jackson.annotation.JsonFormat, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.*, com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper, .JsonValueFormat, com.fasterxml.jackson.databind.ser.ContextualSerializer, com.fasterxml.jackson.databind.util.TokenBuffer

References Deprecated

StdScalarSerializer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Specialized JsonSerializer to output java.util.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.

Field Summary

Modifier and TypeField and Description
protected final Boolean
_asBinary

Configuration setting that indicates if serialization as binary (native or Base64-encoded) has been forced; null means "use default heuristic"

pack-priv static final char[]

Constructor Summary

AccessConstructor and Description
public
protected

Method Summary

Modifier and TypeMethod and Description
private static void
_appendInt(int bits, char[] ch, int offset)

private static final void
_appendInt(int value, byte[] buffer, int offset)

private static void
_appendShort(int bits, char[] ch, int offset)

private static final byte[]
_asBytes(UUID uuid)

protected boolean
public void
public JsonSerializer<?>
createContextual(SerializerProvider
Serializer provider to use for accessing config, other serializers
serializers
,
BeanProperty
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)
property
)

Implements com.fasterxml.jackson.databind.ser.ContextualSerializer.createContextual.

Method called to see if a different (or differently configured) serializer is needed to serialize values of specified property.

public boolean
isEmpty(SerializerProvider prov, UUID value)

Overrides com.fasterxml.jackson.databind.JsonSerializer.isEmpty.

Method called to check whether given serializable value is considered "empty" value (for purposes of suppressing serialization of empty values).

public void
serialize(UUID
Value to serialize; can not be null.
value
,
JsonGenerator
Generator used to output resulting Json content
gen
,
SerializerProvider
Provider that can be used to get serializers for serializing Objects value contains, if any.
provider
)

Implements abstract com.fasterxml.jackson.databind.ser.std.StdSerializer.serialize.

Method that can be called to ask implementation to serialize values of type this serializer handles.

Inherited from com.fasterxml.jackson.databind.ser.std.StdScalarSerializer:
getSchemaserializeWithType

Field Detail

_asBinaryback to summary
protected final Boolean _asBinary

Configuration setting that indicates if serialization as binary (native or Base64-encoded) has been forced; null means "use default heuristic"

Since
2.11.3
HEX_CHARSback to summary
pack-priv static final char[] HEX_CHARS

Constructor Detail

UUIDSerializerback to summary
public UUIDSerializer()
UUIDSerializerback to summary
protected UUIDSerializer(Boolean asBinary)
Since
2.11.3

Method Detail

_appendIntback to summary
private static void _appendInt(int bits, char[] ch, int offset)
_appendIntback to summary
private static final void _appendInt(int value, byte[] buffer, int offset)
_appendShortback to summary
private static void _appendShort(int bits, char[] ch, int offset)
_asBytesback to summary
private static final byte[] _asBytes(UUID uuid)
_writeAsBinaryback to summary
protected boolean _writeAsBinary(JsonGenerator g)
acceptJsonFormatVisitorback to summary
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException

Overrides com.fasterxml.jackson.databind.ser.std.StdScalarSerializer.acceptJsonFormatVisitor.

Implements com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable.acceptJsonFormatVisitor.

Doc from com.fasterxml.jackson.databind.ser.std.StdSerializer.acceptJsonFormatVisitor.

Default implementation specifies no format. This behavior is usually overriden by custom serializers.

Parameters
typeHint:JavaType

Doc from com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable.acceptJsonFormatVisitor.

Type of element (entity like property) being visited

Annotations
@Override
createContextualback to summary
public JsonSerializer<?> createContextual(SerializerProvider serializers, BeanProperty property) throws JsonMappingException

Implements com.fasterxml.jackson.databind.ser.ContextualSerializer.createContextual.

Doc from com.fasterxml.jackson.databind.ser.ContextualSerializer.createContextual.

Method called to see if a different (or differently configured) serializer is needed to serialize values of specified property. Note that instance that this method is called on is typically shared one and as a result method should NOT modify this instance but rather construct and return a new instance. This instance should only be returned as-is, in case it is already suitable for use.

Parameters
serializers:SerializerProvider

Serializer provider to use for accessing config, other serializers

property:BeanProperty

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)

Returns:JsonSerializer<?>

Serializer to use for serializing values of specified property; may be this instance or a new instance.

Annotations
@Override
isEmptyback to summary
public boolean isEmpty(SerializerProvider prov, UUID value)

Overrides com.fasterxml.jackson.databind.JsonSerializer.isEmpty.

Doc from com.fasterxml.jackson.databind.JsonSerializer.isEmpty.

Method called to check whether given serializable value is considered "empty" value (for purposes of suppressing serialization of empty values).

Default implementation will consider only null values to be empty.

Note

replaces isEmpty(Object), which was deprecated in 2.5

Annotations
@Override
serializeback to summary
public void serialize(UUID value, JsonGenerator gen, SerializerProvider provider) throws IOException

Implements abstract com.fasterxml.jackson.databind.ser.std.StdSerializer.serialize.

Doc from com.fasterxml.jackson.databind.JsonSerializer.serialize.

Method that can be called to ask implementation to serialize values of type this serializer handles.

Parameters
value:UUID

Value to serialize; can not be null.

gen:JsonGenerator

Generator used to output resulting Json content

provider:SerializerProvider

Provider that can be used to get serializers for serializing Objects value contains, if any.

Annotations
@Override