Class PreconditionUtils

java.lang.Object
org.gbif.utils.PreconditionUtils

public final class PreconditionUtils extends Object
  • 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.
    static void
    checkState(boolean expression)
    Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.
    static void
    checkState(boolean expression, Object errorMessage)
    Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method.

    Methods inherited from class java.lang.Object

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

    • checkState

      public static void checkState(boolean expression)
      Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method. From Guava.
      Parameters:
      expression - a boolean expression
      Throws:
      IllegalStateException - if expression is false
    • checkState

      public static void checkState(boolean expression, @Nullable Object errorMessage)
      Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method. From Guava.
      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:
      IllegalStateException - if expression is false
    • checkArgument

      public static void checkArgument(boolean expression)
      Ensures the truth of an expression involving one or more parameters to the calling method. From Guava.
      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. From Guava.
      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