-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Construct transparent objects #968
Comments
Hey @robertvazan, Would like to contribute to this issue? Could you please assign this issue to me? And just to confirm you are looking for an API which would call a generalized method and outputs the certain result based on the type parameter, right? |
FWIW, I implemented something extremely similar to this for in-lining static final fields of a complex Object: https://github.com/Christopher-Chianelli/timefold-solver/blob/38c98a8b6311ac1ecc7fafccc35db748f7080db8/spring-integration/spring-boot-autoconfigure/src/main/java/ai/timefold/solver/spring/boot/autoconfigure/util/PojoInliner.java In theory, it could be modified to work with any
|
Managed to make it work with fragments: #999 |
It would be neat to have CodeBlock API that recursively emits code to construct transparent values (records, arrays, collections, enums, primitives, strings, and null, perhaps others).
For now, I have a utility method that does this for the types I care about:
This could be implemented as a new parameter type (perhaps
$V
for value) that generalizes$L
and$S
. It would sort of serialize values as Java code the same way JSON serializes values as JavaScript code.The text was updated successfully, but these errors were encountered: