RFR: 8274771: Map, FlatMap and OrElse fluent bindings for ObservableValue [v3]

John Hendrikx jhendrikx at openjdk.java.net
Wed Jan 5 12:29:12 UTC 2022


On Wed, 5 Jan 2022 09:45:21 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> modules/javafx.base/src/main/java/javafx/beans/binding/ObjectBinding.java line 193:
>> 
>>> 191:      *
>>> 192:      * @return {@code true} when this binding currently has one or more
>>> 193:      *     listeners, otherwise {@code false}
>> 
>> Maybe the method description
>> `Checks if the binding has at least one listener registered on it.`
>> is more straightforward, especially since it is a first-sentence summary. The `@return` description can contain the info on what is returned. As for that, maybe
>> `{@code true} if this binding currently has one or more listeners registered on it, otherwise {@code false}`
>> is more precise.
>> I'm not sure if "registered on" or "registered to" is better, not that I think it matters.
>> 
>> I would also like to see an explanation of how the method should/can be used by subclasses, but it looks to be tied to `Subscription`, which isn't added yet, so I don't have a good idea on this.
>
> It is not strictly tied to `Subscription`, the method is required to determine when `LazyObjectBinding` must register listeners on its dependencies and when it can remove them again (basically when it stops being lazy or when it can become lazy again).

I've added "This is useful for subclasses which want to conserve resources when not observed."

-------------

PR: https://git.openjdk.java.net/jfx/pull/675


More information about the openjfx-dev mailing list