Class BeanSerializer

    • Constructor Detail

      • BeanSerializer

        public BeanSerializer​(JavaType type,
                              BeanSerializerBuilder builder,
                              BeanPropertyWriter[] properties,
                              BeanPropertyWriter[] filteredProperties)
        Parameters:
        builder - Builder object that contains collected information that may be needed for serializer
        properties - Property writers used for actual serialization
    • Method Detail

      • createDummy

        @Deprecated
        public static BeanSerializer createDummy​(JavaType forType)
        Deprecated.
        Since 2.10
      • unwrappingSerializer

        public JsonSerializer<java.lang.Object> unwrappingSerializer​(NameTransformer unwrapper)
        Description copied from class: JsonSerializer
        Method that will return serializer instance that produces "unwrapped" serialization, if applicable for type being serialized (which is the case for some serializers that produce JSON Objects as output). If no unwrapped serializer can be constructed, will simply return serializer as-is.

        Default implementation just returns serializer as-is, indicating that no unwrapped variant exists

        Overrides:
        unwrappingSerializer in class JsonSerializer<java.lang.Object>
        Parameters:
        unwrapper - Name transformation to use to convert between names of unwrapper properties
      • serialize

        public final void serialize​(java.lang.Object bean,
                                    JsonGenerator gen,
                                    SerializerProvider provider)
                             throws java.io.IOException
        Main serialization method that will delegate actual output to configured BeanPropertyWriter instances.
        Specified by:
        serialize in class BeanSerializerBase
        Parameters:
        bean - 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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object