RFR: JDK-8304439: Subscription based listeners [v12]
John Hendrikx
jhendrikx at openjdk.org
Thu Jul 13 21:02:21 UTC 2023
On Thu, 13 Jul 2023 00:00:50 GMT, Nir Lisker <nlisker at openjdk.org> wrote:
>> John Hendrikx has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Fix subscriber -> valueSubscriber
>
> modules/javafx.base/src/main/java/javafx/beans/value/ObservableValue.java line 307:
>
>> 305: /**
>> 306: * Creates a {@link Subscription} on this {@code Observable} which calls the given
>> 307: * {@code changeSubscriber} with the old and new value whenever its value changes.
>
> * There's no need to link `Subscription` since it's linked in the method description.
> * Maybe say "on this `{@code ObservableValue}`" to be more specific, even though it's also an `Observable`.
> * I would also note the similarities to a `ChangeListener` since it's used internally.
>
> Maybe this?
>
> Creates a {@code Subscription} on this {@code ObservableValue} that calls the given {@code
> changeSubscriber} with the old and new values whenever its value changes. This {@code Subscription}
> is akin to a {@code ChangeListener} without the {@code ObservableValue} parameter.
I put:
The provided consumer is akin to a {@code ChangeListener} without the {@code ObservableValue} parameter
...as I think it's not correct to say the `Subscription` is like a change listener, the subscription is only a means to cancel it. The consumer you provide is like the change listener, with one less parameter.
The other changes I added, and also fixed the inconsistencies between the two versions (Consumer/BiConsumer).
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1069#discussion_r1263049694
More information about the openjfx-dev
mailing list