com.fasterxml.jackson.databind.ser.std

Class UUIDSerializer

  • All Implemented Interfaces:
    JsonFormatVisitable, SchemaAware


    public class UUIDSerializer
    extends StdScalarSerializer<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.
    • Constructor Detail

      • UUIDSerializer

        public UUIDSerializer()
    • Method Detail

      • isEmpty

        public boolean isEmpty(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.

        Overrides:
        isEmpty in class JsonSerializer<UUID>
      • serialize

        public void serialize(UUID value,
                     com.fasterxml.jackson.core.JsonGenerator jgen,
                     SerializerProvider provider)
                       throws IOException,
                              com.fasterxml.jackson.core.JsonGenerationException
        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<UUID>
        Parameters:
        value - Value to serialize; can not be null.
        jgen - Generator used to output resulting Json content
        provider - Provider that can be used to get serializers for serializing Objects value contains, if any.
        Throws:
        IOException
        com.fasterxml.jackson.core.JsonGenerationException

Copyright © 2014 FasterXML. All Rights Reserved.