Class Preconditions

java.lang.Object
org.apache.parquet.Preconditions

public final class Preconditions extends Object
Utility for parameter validation
  • Method Details

    • checkNotNull

      @Deprecated public static <T> T checkNotNull(T o, String name) throws NullPointerException
      Type Parameters:
      T - the type of the object
      Parameters:
      o - the param to check
      name - the name of the param for the error message
      Returns:
      the validated o
      Throws:
      NullPointerException - if o is null
    • 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 arg0) 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.
      arg0 - First parameter of the message string template
      Throws:
      IllegalArgumentException - if isValid is false
    • checkArgument

      public static void checkArgument(boolean isValid, String message, Object arg0, Object arg1) 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.
      arg0 - First parameter of the message string template
      arg1 - Second parameter of the message string template
      Throws:
      IllegalArgumentException - if isValid is false
    • checkArgument

      public static void checkArgument(boolean isValid, String message, Object arg0, Object arg1, Object arg2) 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.
      arg0 - First parameter of the message string template
      arg1 - Second parameter of the message string template
      arg2 - Third parameter of the message string template
      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 isValid, String message) throws IllegalStateException
      Precondition-style validation that throws IllegalStateException.
      Parameters:
      isValid - true if valid, false if an exception should be thrown
      message - A String message for the exception.
      Throws:
      IllegalStateException - if isValid is false
    • checkState

      public static void checkState(boolean isValid, String message, Object arg0) throws IllegalStateException
      Precondition-style validation that throws IllegalStateException.
      Parameters:
      isValid - true if valid, false if an exception should be thrown
      message - A String message for the exception.
      arg0 - First parameter of the message string template
      Throws:
      IllegalStateException - if isValid is false
    • checkState

      public static void checkState(boolean isValid, String message, Object arg0, Object arg1) throws IllegalStateException
      Precondition-style validation that throws IllegalStateException.
      Parameters:
      isValid - true if valid, false if an exception should be thrown
      message - A String message for the exception.
      arg0 - First parameter of the message string template
      arg1 - Second parameter of the message string template
      Throws:
      IllegalStateException - if isValid is false
    • checkState

      public static void checkState(boolean isValid, String message, Object arg0, Object arg1, Object arg2) throws IllegalStateException
      Precondition-style validation that throws IllegalStateException.
      Parameters:
      isValid - true if valid, false if an exception should be thrown
      message - A String message for the exception.
      arg0 - First parameter of the message string template
      arg1 - Second parameter of the message string template
      arg2 - Third parameter of the message string template
      Throws:
      IllegalStateException - if isValid is false
    • checkState

      public static void checkState(boolean isValid, String message, Object... args) throws IllegalStateException
      Precondition-style validation that throws IllegalStateException.
      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:
      IllegalStateException - if isValid is false