Class Preconditions

Object
io.delta.kernel.internal.util.Preconditions

public class Preconditions extends Object
Static convenience methods that help a method or constructor check whether it was invoked correctly (that is, whether its preconditions were met).
  • Method Details

    • checkArgument

      public static void checkArgument(boolean isValid) throws IllegalArgumentException
      Precondition-style validation that throws IllegalArgumentException.
      Parameters:
      isValid - true if valid, false if an exception should be thrown
      Throws:
      IllegalArgumentException - if isValid is false
    • checkArgument

      public static void checkArgument(boolean isValid, String message) throws IllegalArgumentException
      Precondition-style validation that throws IllegalArgumentException.
      Parameters:
      isValid - true if valid, false if an exception should be thrown
      message - A String message for the exception.
      Throws:
      IllegalArgumentException - if isValid is false
    • checkArgument

      public static void checkArgument(boolean isValid, String message, Object... args) throws IllegalArgumentException
      Precondition-style validation that throws IllegalArgumentException.
      Parameters:
      isValid - true if valid, false if an exception should be thrown
      message - A String message for the exception.
      args - Objects used to fill in %s placeholders in the message
      Throws:
      IllegalArgumentException - if isValid is false
    • checkState

      public static void checkState(boolean expression, String errorMessage)
      Ensures the truth of an expression involving the state of the calling instance.
      Parameters:
      expression - a boolean expression
      errorMessage - the exception message to use if the check fails
      Throws:
      IllegalStateException - if expression is false