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

[automation] Allow returning null from supplier function in ValueCache #4427

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

florian-h05
Copy link
Contributor

In some cases, it is useful to be able to return null from the supplier function using null as an "unspecified" value.

This is a proposal, please let me know what you think @J-N-K.

In some cases, it is useful to be able to return null from the supplier function using null as an "unspecified" value.

Signed-off-by: Florian Hotze <[email protected]>
@J-N-K
Copy link
Member

J-N-K commented Oct 26, 2024

What would be the use-case for that? My intention when writing this code was to make it work like Optional.orElseGet (https://docs.oracle.com/javase/10/docs/api/java/util/Optional.html#orElseGet(java.util.function.Supplier)), but I'm open for suggestions here.

@J-N-K J-N-K added the enhancement An enhancement or new feature of the Core label Oct 26, 2024
@florian-h05
Copy link
Contributor Author

I currently cannot really think of the exact use case, but I regularly return null in my JS rules from functions from the JS perspective it would be nice to have.
FYI I have mainly opened this PR here because of openhab/openhab-js#386.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature of the Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants