Class ImmutableReference<T>


  • public class ImmutableReference<T>
    extends java.lang.Object
    Simple class that holds an immutable reference to another object (or to null).
    Author:
    Brian Stansberry
    • Constructor Summary

      Constructors 
      Constructor Description
      ImmutableReference​(T referent)
      Create a new ImmutableReference.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T get()
      Gets the wrapped object, if there is one.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ImmutableReference

        public ImmutableReference​(T referent)
        Create a new ImmutableReference.
        Parameters:
        referent - the object to refer to, or null
    • Method Detail

      • get

        public T get()
        Gets the wrapped object, if there is one.
        Returns:
        the object passed to the constructor, or null if null was passed to the constructor