Class EmbeddedObjectSerializer<T>

  • All Implemented Interfaces:
    com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
    Direct Known Subclasses:
    CalendarSerializer, DateSerializer, ObjectIdSerializer

    public abstract class EmbeddedObjectSerializer<T>
    extends TransformingEmbeddedObjectSerializer<T,​T>
    Safe embedded object serializer.

    When used with BsonObjectGenerator or DBEncoderBsonGenerator, passes values straight through.

    When used with a TokenBuffer (as by BeanDeserializer.deserializeWithUnwrapped(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext)), temporarily clears the TokenBuffer codec before passing the value through, so it will be properly serialized as an embedded object. (Failure to do so would blow up the stack, as the TokenBuffer would pass the object right back to the ObjectMapper.)

    When used with other JsonSerializers, throws IllegalArgumentException with a message that it's designed for use only with BsonObjectGenerator or DBEncoderBsonGenerator or TokenBuffer.

    Since:
    3.0.4
    Author:
    Kevin D. Keck
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer

        com.fasterxml.jackson.databind.JsonSerializer.None
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void serialize​(T value, com.fasterxml.jackson.core.JsonGenerator jgen, com.fasterxml.jackson.databind.SerializerProvider provider)  
      protected T transform​(T value)
      Transform to the desired type.
      protected void writeEmbeddedObject​(T value, com.fasterxml.jackson.core.JsonGenerator jgen)  
      • Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer

        acceptJsonFormatVisitor, getDelegatee, handledType, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId, withIgnoredProperties