Class Objects

java.lang.Object
de.espirit.common.tools.Objects

public final class Objects extends Object
Generic utility to provide null-safe operations.
Since:
5.2.21
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    equal(@Nullable Object a, @Nullable Object b)
    Test the given objects on equality.
    static <T, D extends T>
    T
    nvl(T value, D defaultValue)
    Returns the first parameter if it's not null, else the second.

    Methods inherited from class java.lang.Object

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

    • Objects

      public Objects()
  • Method Details

    • equal

      public static boolean equal(@Nullable @Nullable Object a, @Nullable @Nullable Object b)
      Test the given objects on equality. Will return true, if either a and b are null or a.equals(b). For arrays the content is compared for equality (deep equals).
      Parameters:
      a - first object to compare.
      b - second object to compare.
      Returns:
      true, if a is equal to b or both a and b are null.
      Since:
      5.2.21
    • nvl

      @NotNull public static <T, D extends T> T nvl(@Nullable T value, @NotNull D defaultValue)
      Returns the first parameter if it's not null, else the second.
      Parameters:
      value - Value to return if not null.
      defaultValue - Value tor return if first argument is null - must be not null.
      Returns:
      Returns the first parameter if it's not null, else the second.
      Since:
      5.2.21