Class AssertUtil

java.lang.Object
com.webauthn4j.util.AssertUtil

public class AssertUtil extends Object
Assertion utility class that assists in validating arguments.

Members are copied from org.springframework.util.Assert class

Original Assert class authors: Keith Donald Juergen Hoeller Sam Brannen Colin Sampaleanu Rob Harrop

  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    isTrue(boolean condition, @NonNull String message)
     
    static void
    notEmpty(@Nullable Object[] array, @NonNull String message)
    Assert that an array contains elements; that is, it must not be null and must contain at least one element.
    static void
    notEmpty(@Nullable Collection<?> collection, @NonNull String message)
    Assert that a collection contains elements; that is, it must not be null and must contain at least one element.
    static void
    notNull(@Nullable Object object, @NonNull String message)
    Assert that an object is not null.

    Methods inherited from class java.lang.Object

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

    • notNull

      public static void notNull(@Nullable Object object, @NonNull String message)
      Assert that an object is not null.
      Assert.notNull(clazz, "The class must not be null");
      Parameters:
      object - the object to check
      message - the exception message to use if the assertion fails
      Throws:
      IllegalArgumentException - if the object is null
    • notEmpty

      public static void notEmpty(@Nullable Object[] array, @NonNull String message)
      Assert that an array contains elements; that is, it must not be null and must contain at least one element.
      Assert.notEmpty(array, "The array must contain elements");
      Parameters:
      array - the array to check
      message - the exception message to use if the assertion fails
      Throws:
      IllegalArgumentException - if the object array is null or contains no elements
    • notEmpty

      public static void notEmpty(@Nullable Collection<?> collection, @NonNull String message)
      Assert that a collection contains elements; that is, it must not be null and must contain at least one element.
      Assert.notEmpty(collection, "Collection must contain elements");
      Parameters:
      collection - the collection to check
      message - the exception message to use if the assertion fails
      Throws:
      IllegalArgumentException - if the collection is null or contains no elements
    • isTrue

      public static void isTrue(boolean condition, @NonNull String message)