Class ArgumentCheck

java.lang.Object
app.babylon.lang.ArgumentCheck

public final class ArgumentCheck extends Object
Small argument validation helpers used throughout the library.
  • Method Details

    • nonNegative

      public static int nonNegative(int i)
      Requires a non-negative integer.
      Parameters:
      i - value to validate
      Returns:
      the supplied value
    • nonEmpty

      public static <T> T[] nonEmpty(T[] x)
      Requires a non-empty array.
      Type Parameters:
      T - array element type
      Parameters:
      x - array to validate
      Returns:
      the supplied array
    • nonEmpty

      public static <T extends Collection<?>> T nonEmpty(T c)
      Requires a non-empty collection.
      Type Parameters:
      T - collection type
      Parameters:
      c - collection to validate
      Returns:
      the supplied collection
    • nonEmpty

      public static String nonEmpty(String s)
      Requires a non-empty string.
      Parameters:
      s - string to validate
      Returns:
      the supplied string
    • nonNull

      public static <T> T nonNull(T o)
      Requires a non-null reference.
      Type Parameters:
      T - object type
      Parameters:
      o - object to validate
      Returns:
      the supplied object
    • nonNull

      public static <T> T nonNull(T o, String message)
      Requires a non-null reference with a custom error message.
      Type Parameters:
      T - object type
      Parameters:
      o - object to validate
      message - null failure message
      Returns:
      the supplied object