Class Guard

java.lang.Object
com.github.martincooper.datatable.Guard

public class Guard extends Object
Guard class. Used to validate class arguments. Created by Martin Cooper on 13/07/2017.
  • Constructor Details

    • Guard

      public Guard()
  • Method Details

    • notNull

      public static void notNull(Object argument, String name)
      Asserts the value is not null. Throws an IllegalArgumentException if it is.
      Parameters:
      argument - The argument to check.
      name - The name of the argument.
    • itemsNotNull

      public static <T> void itemsNotNull(Iterable<T> argument, String name)
      Asserts the argument, and none of it's iterable items, is null. Throws an IllegalArgumentException if it is.
      Type Parameters:
      T - The argument type.
      Parameters:
      argument - The argument to check.
      name - The name of the argument.
    • itemsNotNull

      public static <T> void itemsNotNull(T[] argument, String name)
      Asserts the argument, and none of it's items, is null. Throws an IllegalArgumentException if it is.
      Type Parameters:
      T - The argument type.
      Parameters:
      argument - The argument to check.
      name - The name of the argument.
    • tryNotNull

      public static <T> io.vavr.control.Try<T> tryNotNull(T argument, String name)
      Asserts the argument is not null. Returns in a Try.
      Type Parameters:
      T - The argument type.
      Parameters:
      argument - The argument to check.
      name - The name of the argument.
      Returns:
      Returns a Try testing the argument being null.