serializer icon indicating copy to clipboard operation
serializer copied to clipboard

Question: are immutable objects with builders supported?

Open remal opened this issue 1 year ago • 3 comments

In our code, we have a lot of DTOs like this:

@lombok.Value
@lombok.Builder
class Entity {

  String requiredField;

  @lombok.Builder.Default
  String requiredFieldWithDefaultValue = "default value";

}

For the provided example, Lombok generates a private constructor, getters, and a builder with a default value for requiredFieldWithDefaultValue field.

Will such an object be correctly deserialized by this library? By "correctly" I mean:

  1. Deserialization works with a private constructor.
  2. If the requiredFieldWithDefaultValue field was added only in the second version of the class, deserializing content from the first version (without this field) will have "default value" as a default value for the field.

remal avatar Feb 26 '24 00:02 remal