Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I use some methods of lombok when generate pojos? #175

Open
leavestylecode opened this issue Jan 6, 2021 · 2 comments
Open

Can I use some methods of lombok when generate pojos? #175

leavestylecode opened this issue Jan 6, 2021 · 2 comments

Comments

@leavestylecode
Copy link

leavestylecode commented Jan 6, 2021

I hope generated pojos can support @with @builder(toBuilder = true).

Create an immutable object & edit pojos can be more functional.

@jklingsporn
Copy link
Owner

Can you give an example what you are trying to achieve? How would the final POJO look like? Currently, there is no lombok-support planned.

@leavestylecode
Copy link
Author

Sometimes we obtain model from db, we want to change some params value of this. From the characteristics of functional programming, we hope that objects have immutability and no side effects. So I often use @with @builder(toBuilder = true) of Lombok.

When I change a value of model. Such as change name, I will....
var newModel = model.withName(newName);
When I change multi values of model. Such as change name、address、profession, I will....
var newModel = model.toBuilder.name(newName).address(newAddress).profession(newProfession).build();

return a new model. I don't worry about data conflicts or data being overwritten.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants