Custom nullability check for kotlin and other @NotNull types #6837
Closed
IceBlizz6
started this conversation in
Design Proposals
Replies: 2 comments
-
You can implement a custom |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you @beikov ! I solved it using
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm currently working on a Kotlin codebase that is using Hibernate.
![image](https://private-user-images.githubusercontent.com/38980218/247289110-516e7ab7-f92e-4d58-a1a0-a412ed5afaf4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMDczODQsIm5iZiI6MTczOTEwNzA4NCwicGF0aCI6Ii8zODk4MDIxOC8yNDcyODkxMTAtNTE2ZTdhYjctZjkyZS00ZDU4LWExYTAtYTQxMmVkNWFmYWY0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA5VDEzMTgwNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTIzNTQyNTE1MTVhZjQxNmJlNjcxYTM0NDhlMzlkZThmYWM3NTViODNiMGVmZmNjNDNlYjg0YWNlMmEyMDRiOTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.thiqA1Zst_PA6Od1-O-ukkV2JTY5Q-9EWaAu6HJwoP4)
In kotlin it is possible to check for nullability through reflection.
I want a way to tell Hibernate to use this in order to apply nullability.
This will affect schema generation (not null to columns) and validation,
similar to how jakarta.validation.constraints.NotNull annotation works now.
My suggestion is to give us a way to add or override the existing nullability check.
The simplest example of how this could look like is:
=== Hibernate codebase ===
=== My project ===
In this way it will be possible to easily configure nullability check for kotlin projects,
And it will also make it easier to check for other NotNull annotations.
Beta Was this translation helpful? Give feedback.
All reactions