Skip to content

Make NumberSerializers.Base public and its inherited classes not final #2116

@edouardmercier

Description

@edouardmercier

In v2.9.6, I needed to have the NumberSerializers.FloatSerializer customized so as to remove the trailing float 0 after the decimal separator when the value is actually an integer, because I could not find a way to configure the Jackson serializer so. Example: I want the "1.0" value to be serialized as "1" and not "1.0".

Hence, I wanted to inherit from the NumberSerializers.FloatSerializer class, so as to overload the JsonSerializer.serialize(Object value, JsonGenerator generator, SerializerProvider provider) method, but discovered that:

  1. the NumberSerializers.Base class is protected ;
  2. the NumberSerializers.FloatSerializer is final.

Would it be possible to make the NumberSerializers.Base class public and the NumberSerializers.FloatSerializer not final, please?

Indeed, this would make the number serializer more open and prevent from copy/pasting the NumberSerializers.Base code when writing a number serializer which overloads the default behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions