de.caff.generics.util

## Interface IReference<T>

- Type Parameters:
    `T` - type of referenced object
  All Known Implementing Classes:
    CopyRef, HardReferenceImpl, MutableRef, SoftReferenceImpl, WeakReferenceImpl
  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 IReference<T>

  A reference to an object. This is similar to `Reference`, but implemented as an interface to also allow hard references and more.
  Author:
    Rammi

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static IReference<?>` | `NULL_REF` Null reference.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `T` | `get()` Get the referenced object.
    `static <R> IReference<R>` | `hard(R obj)` Get a hard reference.
    `default boolean` | `isNull()` Is this the null reference?
    `static <R> IReference<R>` | `nullRef()` Get a null reference.
    `static <R> IReference<R>` | `soft(R obj)` Get a soft reference.
    `static <R> IReference<R>` | `weak(R obj)` Get a weak reference.

- - ### Field Detail

    - #### NULL_REF

          static final IReference<?> NULL_REF

      Null reference. This always returns `null` on `get()`. Use `nullRef()` instead to avoid compiler warnings.

  - ### Method Detail

    - #### get

          @Nullable
          T get()

      Get the referenced object. Depending on the implementation this might return `null` if the referenced object is garbage collected or this is a `null reference`.
      Returns:
        referenced object, or `null`

    - #### isNull

          default boolean isNull()

      Is this the null reference? Don't override this method.
      Returns:
        `true`: this is the `null reference`, so returning `null` is its purpose
        `false`: this is not the null reference, so returning `null` means the original object is garbage collected and gone to object nirvana

    - #### nullRef

          @NotNull
          static <R> IReference<R> nullRef()

      Get a null reference.
      Type Parameters:
        `R` - referenced type
      Returns:
        null reference which is always returning `null`

    - #### hard

          @NotNull
          static <R> IReference<R> hard(@Nullable
                                                 R obj)

      Get a hard reference.
      Type Parameters:
        `R` - referenced type
      Parameters:
        `obj` - object to be referenced
      Returns:
        hard reference

    - #### soft

          @NotNull
          static <R> IReference<R> soft(@Nullable
                                                 R obj)

      Get a soft reference. This returns a reference which keeps the referenced object via a `SoftReference`.
      Type Parameters:
        `R` - referenced type
      Parameters:
        `obj` - object to be referenced
      Returns:
        soft reference

    - #### weak

          @NotNull
          static <R> IReference<R> weak(@Nullable
                                                 R obj)

      Get a weak reference. This returns a reference which keeps the referenced object via a `WeakReference`.
      Type Parameters:
        `R` - referenced type
      Parameters:
        `obj` - object to be referenced
      Returns:
        weak reference