Class UUIDSerializer

  • All Implemented Interfaces:
    JsonFormatVisitable, SchemaAware, java.io.Serializable

    public class UUIDSerializer
    extends StdScalarSerializer<java.util.UUID>
    Specialized 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.
    See Also:
    Serialized Form
    • Constructor Detail

      • UUIDSerializer

        public UUIDSerializer()
    • Method Detail

      • isEmpty

        public boolean isEmpty​(SerializerProvider prov,
                               java.util.UUID value)
        Description copied from class: JsonSerializer
        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 JsonSerializer.isEmpty(Object), which was deprecated in 2.5

        Overrides:
        isEmpty in class JsonSerializer<java.util.UUID>
      • serialize

        public void serialize​(java.util.UUID value,
                              JsonGenerator gen,
                              SerializerProvider provider)
                       throws java.io.IOException
        Description copied from class: JsonSerializer
        Method that can be called to ask implementation to serialize values of type this serializer handles.
        Specified by:
        serialize in class StdSerializer<java.util.UUID>
        Parameters:
        value - Value to serialize; can not be null.
        gen - Generator used to output resulting Json content
        provider - Provider that can be used to get serializers for serializing Objects value contains, if any.
        Throws:
        java.io.IOException