druidry icon indicating copy to clipboard operation
druidry copied to clipboard

Feat: add setter and NoArgsConstructor lombok to DruidFilters

Open qiangmao opened this issue 5 years ago • 3 comments

add setter and NoArgsConstructor to DruidFilters, for jackson deserialize DruidFilters from origin json

qiangmao avatar May 23 '19 08:05 qiangmao

Hey @qiangmao

I don't see the point of Setter and NoArgsConstructors. In every filter at least one of the field is required/nonNull hence no need for NoArgsConstructor. We can keep nonNull checks on constructors with required arguments. In some filter where many fields are optional we have builders which is convenient way than NoArgsConstructor and setters combination.

Thanks.

abhi-zapr avatar May 26 '19 09:05 abhi-zapr

Hey, I need to deserialization from JSON(which store in database) with Jackson, Jackson needs a default no arguments Constructors.

qiangmao avatar May 27 '19 01:05 qiangmao

Hey @qiangmao Ok, for your use case it make sense to have this NoArgsConstructor in filters. But how are you handling Polymorphic serialization and deserialization ? Are you using global default typing ? And do we require setters ? Because I was able to serialize and deserialize with global default typing, NoArgsConstructor and Getter.

On side note : With some code overhead you can achieve this using combination of Jackson's MixIn and Creator Feature.

@GG-Zapr does it makes sense to have NoArgsConstructor in filters or any other query formation classes for this serialization and deserialization use case ?

abhi-zapr avatar Jun 15 '19 21:06 abhi-zapr