Class Assert

java.lang.Object
io.r2dbc.proxy.util.Assert

public final class Assert extends Object
Assertion library for the implementation.
  • Method Details

    • requireNonNull

      public static <T> T requireNonNull(@Nullable T t, String message)
      Checks that a specified object reference is not null and throws a customized IllegalArgumentException if it is.
      Type Parameters:
      T - the type of the reference
      Parameters:
      t - the object reference to check for nullity
      message - the detail message to be used in the event that an IllegalArgumentException is thrown
      Returns:
      t if not null
      Throws:
      IllegalArgumentException - if t is {code null}
    • requireType

      public static <T> T requireType(Object value, Class<T> type, String message)
      Checks that the specified value is of a specific type.
      Type Parameters:
      T - the type being required
      Parameters:
      value - the value to check
      type - the type to require
      message - the message to use in exception if type is not as required
      Returns:
      the value casted to the required type
      Throws:
      IllegalArgumentException - if value is not of the required type
      IllegalArgumentException - if value, type, or message is null