Interface Subscription

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
Animation
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 extends AutoCloseable
Something registered that can be removed again: a handler registered with EventTarget.subscribe(EventType, int, EventHandler), which can be removed before its target is discarded, or a registration in a registry such as ComponentRegistry. Removing a component from its tree does not remove its handlers; close the subscription. Close a handler's subscription on the UI thread, as EventTarget requires; a registry's subscriptions follow the registry's own threading rule.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Same as unsubscribe(), so a subscription works in try-with-resources.
    void
    Removes the handler.
  • Method Details

    • unsubscribe

      void unsubscribe()
      Removes the handler. Calling it again does nothing.
    • close

      default void close()
      Same as unsubscribe(), so a subscription works in try-with-resources.
      Specified by:
      close in interface AutoCloseable