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

Add new modules in baker_types to prepare for java17 #1478

Closed
wants to merge 5 commits into from

Conversation

wimleuning
Copy link
Contributor

Add Java 17 support to add new modules for java.time.*, java.util.UUID and java.lang.Record

In Java17 it's not allowed anymore to set values to final fields, instead new modules are created for classes like java.time.*, java.util.UUID and java records to instantiate the object in a non reflective way.

Modules can be extended to add new types.

JavaTimeModule maps LocalDate and LocalDateTime to an epochMillis long value, (and back)
UUIDModule converts the UUID type into a string (and back)
Record type uses the new Java 17 records to read and instantiate a record using Class.isRecord (will fail on java 11) and uses getRecordComponents()[].

wimleuning and others added 5 commits March 31, 2023 10:14
Since UUID fields, Date/DateTime fields are final baker cannot instantiate them in the pojo way.
RecordMod
uses the new record class to instantiate the obejct properly

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

Successfully merging this pull request may close these issues.

3 participants