Class Ref<T>

java.lang.Object
tripleplay.util.Ref<T>

public abstract class Ref<T> extends Object
Maintains a reference to a resource. Handles destroying the resource before releasing the reference.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Ref()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears the target of this reference.
    static <T extends react.Closeable>
    Ref<T>
    create(T target)
    Creates a reference to a Closeable target.
    get()
    Returns the current value of this reference, which may be null.
    set(T target)
    Sets the current value of this reference, clearing any previously referenced object.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Ref

      public Ref()
  • Method Details

    • create

      public static <T extends react.Closeable> Ref<T> create(T target)
      Creates a reference to a Closeable target.
    • get

      public T get()
      Returns the current value of this reference, which may be null.
    • set

      public T set(T target)
      Sets the current value of this reference, clearing any previously referenced object.
      Returns:
      target to enabled code like: F foo = fooref.set(new F()).
    • clear

      public void clear()
      Clears the target of this reference. Automatically calls onClear(T) if the reference contains a non-null target.