Module hash4j

Class Preconditions

java.lang.Object
com.dynatrace.hash4j.internal.Preconditions

public final class Preconditions extends Object
Utility class for preconditions.
  • Method Details

    • checkArgument

      public static void checkArgument(boolean expression)
      Throws an IllegalArgumentException if the given expression evaluates to false.
      Parameters:
      expression - an expression
      Throws:
      IllegalArgumentException - if the given expression evaluates to false
    • checkState

      public static void checkState(boolean expression)
      Throws an IllegalStateException if the given expression evaluates to false.
      Parameters:
      expression - an expression
      Throws:
      IllegalStateException - if the given expression evaluates to false
    • checkArgument

      public static void checkArgument(boolean expression, String errorMessage)
      Throws an IllegalArgumentException if the given expression evaluates to false.
      Parameters:
      expression - an expression
      errorMessage - an error message
      Throws:
      IllegalArgumentException - if the given expression evaluates to false
    • checkArgument

      public static void checkArgument(boolean expression, String errorMessageFormatString, long value)
      Throws an IllegalArgumentException if the given expression evaluates to false.
      Parameters:
      expression - an expression
      errorMessageFormatString - an error message format string with a single %s place holder
      value - a long value
      Throws:
      IllegalArgumentException - if the given expression evaluates to false