Java Optionals in layered entities #199
hrstoyanov
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I created this test layered entity interface:
The generated code is:
The code is mostly OK (and it did not generate code for the default method, good!) but it would be nice to have the option to treat java Optional<>'s specially - basically take the raw objects as inputs, not their Optional wrappers. here is an example of generated code (data):
I think this can be achieved by some adding an annotation like
@OptionalGeneration(OnReturnsOnly=true)
(or something similar):Such generated data objects would take less RAM (I think) and are more conformant with the recommended use of Optional<>'s, ... also, would that help with optimizing the serialization - how are optionals processed?
See :
https://medium.com/@muhammad.ahsan/java-optional-gist-of-tech-talk-by-stuart-marks-at-devoxx-790ae4565bde
https://nipafx.dev/java-optional-opinions/
https://nipafx.dev/intention-revealing-code-java-8-optional
Beta Was this translation helpful? Give feedback.
All reactions