Open codeleep opened 2 weeks ago
This is going to be a hell of a maintenance burden, as this probably needs resolution. Furthermore, it is going to become complicated very quickly: Just think of differently named fields or type mappings.
Mapstruct is the way to go here. It's simply too complex for Lombok.
PS: I'm just a contributor, not a project maintainer, so that's just an opinion. But I doubt the maintainers will come to a different assessment.
This is going to be a hell of a maintenance burden, as this probably needs resolution. Furthermore, it is going to become complicated very quickly: Just think of differently named fields or type mappings.
Mapstruct is the way to go here. It's simply too complex for Lombok.
PS: I'm just a contributor, not a project maintainer, so that's just an opinion. But I doubt the maintainers will come to a different assessment.
I can't be sure whether to attribute him to mapstruct or lombok. I did submit that idea at both repositories.
In view of the purpose of use, he really belongs to mapstruct. Because I just want to be able to convert objects in a minimalist way.
But from experience, I think lombok is more capable in this regard, similar to @AllArgsConstructor @EqualsAndHashCode. All generate specified code in the current class.
For example I am using springboot related framework. I would create an Aform.
Below I will describe my idea:
Suppose I have the following three java beans
I hope they can want to change between the conversion. Then I manually add the corresponding pair constructor
As you can see, when I create different constructors, I can use the new keyword to create corresponding data. But if I write this code manually it makes it very clunky.
Therefore, I hope that the corresponding annotation can be added and the corresponding code can be automatically generated. Such:
Of course, I just provided an idea to simplify the conversion. As for more details, I haven't considered them yet.