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 nullable Bindings #57

Merged
merged 1 commit into from
Nov 24, 2017

Conversation

protogenes
Copy link
Contributor

add overloads to JavaFxObserver and JavaFxSubscriber which allow to unmask null values in an Optional or guarded by a sentinel as counterpart to JavaFxObservable.nullableValuesOf

…nmask null values in an Optional<T> or guarded by a sentinel
value = unmaskingFunction.apply(t);
fireValueChangedEvent();
} catch (Exception e) {
onError(e);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if passing the exception to onError is the right approach

Copy link

@rguillens rguillens Oct 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks fine to me, BindingObserver.onError(throwable) apply user error management if provided or the exception is ignored.

@rguillens
Copy link

rguillens commented Oct 25, 2017

I don't see the point of this PR, maybe I don't understand very well what you want to achieve. I think the main idea behind JavaFxObservable.nullableValuesOf(final ObservableValue<T> fxObservable) and JavaFxObservable.valuesOf(final ObservableValue<T> fxObservable, final T nullSentinel) is to allow passing null values without emitting errors because RxJava 2 doesn't allows null emmissions. To emmit errors when null values occur you should use JavaFxObservable.valuesOf(ObservableValue<T> fxObservable). Please correct me if I'm wrong.

@protogenes
Copy link
Contributor Author

Hi @rguillens,
the idea is to have the counterpart for nullableValuesOf. The JavaFxObserver methods convert a RX observable into a JavaFX binding, of which only the JavaFX bindings allow null values.
JavaFxObservable.nullableValuesOf has been there to hide those null values when building RX observables, but JavaFxObserver was missing methods which restore those null values when going back to a JavaFX binding.
This PR closes this gap.

@rguillens
Copy link

Now I understand your PR and the code looks very good. Congrats...

@thomasnield
Copy link
Collaborator

Hi @protogenes, thank you for contributing this. I'm speaking to KotlinConf this week so I may not be able to follow up until afterwards.

I will take a look at this and merge then.

@protogenes
Copy link
Contributor Author

Hi @thomasnield how was KotlinConf?

@thomasnield
Copy link
Collaborator

@protogenes It was amazing, thank you. The talk will be uploaded to YouTube by JetBrains in the next week or two. The slides for my presentation are here: https://github.com/thomasnield/kotlinconf-datascience-talk

Regarding this PR, I'll try to take a look tonight alongside some PR's for RxKotlin.

@thomasnield
Copy link
Collaborator

I was just about to argue with this, but as I tried to write my alternative solution I get it now. I'll merge tomorrow after I review this with fresh eyes.

@thomasnield
Copy link
Collaborator

Good work, sorry it took me so long to get to this. It's been a busy year.

@thomasnield thomasnield merged commit 632904a into ReactiveX:2.x Nov 24, 2017
@thomasnield
Copy link
Collaborator

I'll do a release for RxJavaFX and RxKotlinFX.

@protogenes protogenes deleted the feature/nullable-observer branch November 28, 2017 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants