-
Notifications
You must be signed in to change notification settings - Fork 103
Plugin to remove java bean methods for when you want to use Lombok or similar #654
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
base: master
Are you sure you want to change the base?
Conversation
… similar Signed-off-by: Asger Askov Blekinge <[email protected]>
|
The "@Asger-KB Asger-KB force-pushed the master branch from 6b5120d to 2974f09" was just me signing the commit... |
|
Hi, I just came across this PR #654 – “Plugin to remove java bean methods for when you want to use Lombok or similar” – and I’m really excited about this feature! We’ve been looking for a clean way to combine JAXB code generation with Lombok (or records/immutables) in several projects, and this plugin would solve a long-standing pain point perfectly. Would it be possible to review and hopefully merge this contribution? It would be a huge help for the community, and I’d be more than happy to help test it or provide any additional feedback if needed. Thank you so much for the amazing work on jaxb-tools – it’s still an indispensable tool in 2025! Best regards, |
|
@calmlaw agreed! The 'jaxb' part is almost secondary.. the value in the tools is for managing models across domains and providing consistent capabilities. The record support probably needs to originate in Eclipse Jakarta jaxb-ri project. @laurentschoelens would be able to help provide more insight as well. Thanks! |
| List<String> lines = Files.readAllLines(javaFile); | ||
| for (int i = 0; i < lines.size(); i++) { | ||
| String line = lines.get(i); | ||
| if (line.matches("^ *public [a-zA-Z]+ (isSet|get)[A-Z]\\w+\\(\\) \\{")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't isSet just be is ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isSet is only to check for list fields.
I guess is should be enough but if we only want to target getters and setters, my best bet would be to find them according properties of the bean ?
|
@Asger-KB : wouldn't be a better option to have specific plugin to handle lombok generation ? |
|
Removing getters and setters could be used in combo with Fluent API plugin and not with Lambok |
fluent-api is the |
|
Yes, fluent-api plugin adds the with* methods |
I wanted to use Lombok for the generated classes (via Annox)
bindings.xjbThis worked, but the generated classes still contained jaxb-produced getter/setters methods. I wanted to be able to generate classes without these methods, so I made these two plugins noGetters and noSetters