Package org.reactfx

Interface Subscription

  • All Known Implementing Classes:
    BiSubscription, MultiSubscription
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface Subscription
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default Subscription and​(Subscription other)
      Returns a new aggregate subscription whose unsubscribe() method calls unsubscribe() on both this subscription and other subscription.
      static <T> Subscription dynamic​(javafx.collections.ObservableSet<T> elems, java.util.function.Function<? super T,​? extends Subscription> f)
      Dynamically subscribes to all elements of the given observable set.
      static <T> Subscription multi​(java.util.function.Function<? super T,​? extends Subscription> f, java.util.Collection<T> elems)
      Subscribes to all elements of the given collection by the given function and returns an aggregate subscription that can be used to cancel all element subscriptions.
      static <T> Subscription multi​(java.util.function.Function<? super T,​? extends Subscription> f, T... elems)
      Subscribes to all elements by the given function and returns an aggregate subscription that can be used to cancel all element subscriptions.
      static Subscription multi​(Subscription... subs)
      Returns a new aggregate subscription whose unsubscribe() method calls unsubscribe() on all arguments to this method.
      void unsubscribe()  
    • Method Detail

      • unsubscribe

        void unsubscribe()
      • and

        default Subscription and​(Subscription other)
        Returns a new aggregate subscription whose unsubscribe() method calls unsubscribe() on both this subscription and other subscription.
      • multi

        @SafeVarargs
        static <T> Subscription multi​(java.util.function.Function<? super T,​? extends Subscription> f,
                                      T... elems)
        Subscribes to all elements by the given function and returns an aggregate subscription that can be used to cancel all element subscriptions.
      • multi

        static <T> Subscription multi​(java.util.function.Function<? super T,​? extends Subscription> f,
                                      java.util.Collection<T> elems)
        Subscribes to all elements of the given collection by the given function and returns an aggregate subscription that can be used to cancel all element subscriptions.
      • dynamic

        static <T> Subscription dynamic​(javafx.collections.ObservableSet<T> elems,
                                        java.util.function.Function<? super T,​? extends Subscription> f)
        Dynamically subscribes to all elements of the given observable set. When an element is added to the set, it is automatically subscribed to. When an element is removed from the set, it is automatically unsubscribed from.
        Parameters:
        elems - observable set of elements that will be subscribed to
        f - function to subscribe to an element of the set.
        Returns:
        An aggregate subscription that tracks elementary subscriptions. When the returned subscription is unsubscribed, all elementary subscriptions are unsubscribed as well, and no new elementary subscriptions will be created.