Class AdditionalPropertiesSerializer

  • All Implemented Interfaces:
    com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable, com.fasterxml.jackson.databind.jsonschema.SchemaAware, com.fasterxml.jackson.databind.ser.ResolvableSerializer, Serializable

    @Beta(V1_7_0)
    public class AdditionalPropertiesSerializer
    extends com.fasterxml.jackson.databind.ser.std.StdSerializer<Object>
    implements com.fasterxml.jackson.databind.ser.ResolvableSerializer
    Custom serializer for serializing complex types with additional properties. If a complex type has a property named "additionalProperties" with serialized name empty ("") of type Map<String, Object>, all items in this map will become top level properties for this complex type.
    See Also:
    Serialized Form
    • Nested Class Summary

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

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

      • Fields inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer

        _handledType
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AdditionalPropertiesSerializer​(Class<?> vc, com.fasterxml.jackson.databind.JsonSerializer<?> defaultSerializer, com.fasterxml.jackson.databind.ObjectMapper mapper)
      Creates an instance of FlatteningSerializer.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static com.fasterxml.jackson.databind.module.SimpleModule getModule​(com.fasterxml.jackson.databind.ObjectMapper mapper)
      Gets a module wrapping this serializer as an adapter for the Jackson ObjectMapper.
      void resolve​(com.fasterxml.jackson.databind.SerializerProvider provider)  
      void serialize​(Object value, com.fasterxml.jackson.core.JsonGenerator jgen, com.fasterxml.jackson.databind.SerializerProvider provider)  
      void serializeWithType​(Object value, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider provider, com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSerializer)  
      • Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer

        _neitherNull, _nonEmpty, acceptJsonFormatVisitor, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, getSchema, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrow
      • Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer

        getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterId
    • Constructor Detail

      • AdditionalPropertiesSerializer

        protected AdditionalPropertiesSerializer​(Class<?> vc,
                                                 com.fasterxml.jackson.databind.JsonSerializer<?> defaultSerializer,
                                                 com.fasterxml.jackson.databind.ObjectMapper mapper)
        Creates an instance of FlatteningSerializer.
        Parameters:
        vc - handled type
        defaultSerializer - the default JSON serializer
        mapper - the object mapper for default serializations
    • Method Detail

      • getModule

        public static com.fasterxml.jackson.databind.module.SimpleModule getModule​(com.fasterxml.jackson.databind.ObjectMapper mapper)
        Gets a module wrapping this serializer as an adapter for the Jackson ObjectMapper.
        Parameters:
        mapper - the object mapper for default serializations
        Returns:
        a simple module to be plugged onto Jackson ObjectMapper.
      • serialize

        public void serialize​(Object value,
                              com.fasterxml.jackson.core.JsonGenerator jgen,
                              com.fasterxml.jackson.databind.SerializerProvider provider)
                       throws IOException
        Specified by:
        serialize in class com.fasterxml.jackson.databind.ser.std.StdSerializer<Object>
        Throws:
        IOException
      • resolve

        public void resolve​(com.fasterxml.jackson.databind.SerializerProvider provider)
                     throws com.fasterxml.jackson.databind.JsonMappingException
        Specified by:
        resolve in interface com.fasterxml.jackson.databind.ser.ResolvableSerializer
        Throws:
        com.fasterxml.jackson.databind.JsonMappingException
      • serializeWithType

        public void serializeWithType​(Object value,
                                      com.fasterxml.jackson.core.JsonGenerator gen,
                                      com.fasterxml.jackson.databind.SerializerProvider provider,
                                      com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSerializer)
                               throws IOException
        Overrides:
        serializeWithType in class com.fasterxml.jackson.databind.JsonSerializer<Object>
        Throws:
        IOException