Class PreconditionUtils

java.lang.Object
org.gbif.api.util.PreconditionUtils

public final class PreconditionUtils extends Object
Analogues of methods from guava's Preconditions
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    checkArgument(boolean expression)
    Ensures the truth of an expression involving one or more parameters to the calling method.
    static void
    checkArgument(boolean expression, Object errorMessage)
    Ensures the truth of an expression involving one or more parameters to the calling method.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • checkArgument

      public static void checkArgument(boolean expression)
      Ensures the truth of an expression involving one or more parameters to the calling method.
      Parameters:
      expression - a boolean expression
      Throws:
      IllegalArgumentException - if expression is false
    • checkArgument

      public static void checkArgument(boolean expression, @Nullable Object errorMessage)
      Ensures the truth of an expression involving one or more parameters to the calling method.
      Parameters:
      expression - a boolean expression
      errorMessage - the exception message to use if the check fails; will be converted to a string using String.valueOf(Object)
      Throws:
      IllegalArgumentException - if expression is false