Class Wrapper<T>

java.lang.Object
com.pnfsoftware.jeb.util.base.Wrapper<T>
Type Parameters:
T - wrapped value type

public class Wrapper<T> extends Object
Wrap an object. Akin to Optional with support for null. This class implements hashCode() and equals(Object).
  • Field Details

    • NULL

      public static final Wrapper<?> NULL
      Shared wrapper for a null value.
  • Method Details

    • wrap

      public static <T> Wrapper<T> wrap(T object)
      Wrap a value.
      Type Parameters:
      T - wrapped value type
      Parameters:
      object - value to wrap
      Returns:
      a wrapper for the provided value
    • get

      public T get()
      Retrieve the wrapped value.
      Returns:
      the wrapped value, which may be null if null was wrapped
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object