Repository navigation
Replies: 2 comments 3 replies
|
+1 for For projects not on Java14, Lombok can do a lot of heavy lifting re boiler plate on data classes. |
0 replies
|
😬 I'd rather use IntelliJ / manually hand write getters and setters than Lombok |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi all, at the request of @jamietanna I've done a quick look-over and some small things jumped out. None of them are game-breakers and you'd be reasonably justified in not acting on most of these.
Records
I notice you've got an issue for this already (#4). Records are a good replacement for data classes as immutable containers, but do not support setters out-of-the-box and I don't know about its compatibility with Spring auto-serialisation.
If both of these things are fine for your use case, then the data classes
DataandApiMetadatawould become something likepublic record Data(String apiVersion, Data data) {}I notice in #5 that there are data access objects that might be in play soon; even if you keep the original classes as non-records, they would be a great fit for read-only data because of their immutability. In this case,
fromDao()/toDao()methods might be useful to take that boilerplate out of call-site code.Tests
There's a
jsonContentfield in ApiMetadataTest. You could probably remove it in this class and have local variables in each test because (as far as I can tell) this data is not shared.Even though this project uses AssertJ and I'm more familiar with Hamcrest, I would extol the virtues of custom matchers/assertions. If it's an object that's going to be in lots of tests, then this will pay off in readability quite quickly.
varI'm a big fan of using
varfor readability where the type can be reasonably inferred from the context. For example:Gradle configuration
I'd advocate turning on reproducible builds in the gradle config. It costs basically nothing, and it's one of the things for the highest level of Supply-chain Levels for Software Artifacts (SLSA).
All reactions