Interface DelegatingLivenessNode

All Superinterfaces:
LivenessManager, LivenessNode, LivenessReferent
All Known Implementing Classes:
FigureWidget

public interface DelegatingLivenessNode extends LivenessNode
Indicates that this class implements LivenessNode via a member rather than implementing it directly. The real LivenessNode is exposed via asLivenessNode(), all other methods delegate to this instance.
  • Method Details

    • asLivenessNode

      LivenessNode asLivenessNode()
      Returns the "real" LivenessNode instance. When implementing this, care should be taken to match lifecycle of the DelegatingLivenessNode instance with this instance, as the returned LivenessNode behaves as a proxy for this.
      Returns:
      a LivenessNode to use to manage this object's liveness.
    • tryManage

      default boolean tryManage(@NotNull @NotNull LivenessReferent referent)
      Description copied from interface: LivenessManager
      Attempt to add referent to this manager. Will succeed if referent is live and if this manager is not a LivenessReferent or is live.
      Specified by:
      tryManage in interface LivenessManager
      Parameters:
      referent - The referent to add
      Returns:
      Whether the referent was in fact added
    • tryUnmanage

      default boolean tryUnmanage(@NotNull @NotNull LivenessReferent referent)
      Description copied from interface: LivenessNode
      If this node is still live and manages referent one or more times, drop one such reference.
      Specified by:
      tryUnmanage in interface LivenessNode
      Parameters:
      referent - The referent to drop
      Returns:
      Whether this node was live and thus in fact tried to drop a reference
    • tryUnmanage

      default boolean tryUnmanage(@NotNull @NotNull Stream<? extends LivenessReferent> referents)
      Description copied from interface: LivenessNode
      For each referent in referents, if this node is still live and manages referent one or more times, drop one such reference.
      Specified by:
      tryUnmanage in interface LivenessNode
      Parameters:
      referents - The referents to drop
      Returns:
      Whether this node was live and thus in fact tried to drop a reference
    • tryRetainReference

      default boolean tryRetainReference()
      Description copied from interface: LivenessReferent
      If this referent is "live", behave as LivenessReferent.retainReference() and return true. Otherwise, returns false rather than throwing an exception.
      Specified by:
      tryRetainReference in interface LivenessReferent
      Returns:
      True if this referent was retained, false otherwise
    • dropReference

      default void dropReference()
      Description copied from interface: LivenessReferent
      Drop a previously-retained reference to this referent.
      Specified by:
      dropReference in interface LivenessReferent
    • getWeakReference

      default WeakReference<? extends LivenessReferent> getWeakReference()
      Description copied from interface: LivenessReferent
      Get a WeakReference to this referent. This may be cached, or newly created.
      Specified by:
      getWeakReference in interface LivenessReferent
      Returns:
      A new or cached reference to this referent