Hi lads,
I'm trying to use Lombok and JacksonMapper together and I've found a suboptimal solution to a couple of issues I've encountered, but I believe either I'm not seeing a proper solution or there might be a couple of solutions Lombok might be able to implement.
Let me describe the issue first.
I wish to use value objects when sending data out via Jackson, so I would like to use the @Value annotation on my model objects, but at the same time, I wish to use the same objects for Jackson serialization/deserialization.
To allow easy data manipulation of my value objects I also use the @Builder and @Wither annotation on my model objects.
I know I need the @AllArgsConstructor for the @Builder, so that is added as well.
To instruct Jackson to use the builder I need to add an annotation to the generated builder class, but there is no option for that, like the onMethod = @__({ annotations } available for @Getter/@seter, etc...Something like onType would help here.
Missing that feature I've opted for letting Jackson use the default constructor (@NoArgsConstructor on my model objects), in violation of the value objects principle, but not having setters will make this default constructor pretty useless: it's still somewhat valid.
Am I missing anything? Is there another way I didn't see through which I can use Lombok with Jackson?