Class Assertions


  • @Deprecated(since="2021-05-27")
    public final class Assertions
    extends java.lang.Object
    Deprecated.
    Usage of this API is not supported in AEM as a Cloud Service.

    Design by contract assertions.

    This class is not part of the public API and may be removed or changed at any time.

    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static void doesNotContainNull​(java.lang.String name, java.util.Collection<?> collection)
      Deprecated.
      Throw IllegalArgumentException if the collection contains a null value.
      static void isTrue​(java.lang.String name, boolean condition)
      Deprecated.
      Throw IllegalStateException if the condition if false.
      static void isTrue​(java.lang.String name, boolean condition, SingleResultCallback<?> callback)
      Deprecated.
      Throw IllegalStateException if the condition if false.
      static void isTrueArgument​(java.lang.String name, boolean condition)
      Deprecated.
      Throw IllegalArgumentException if the condition if false.
      static <T> T notNull​(java.lang.String name, T value)
      Deprecated.
      Throw IllegalArgumentException if the value is null.
      static <T> T notNull​(java.lang.String name, T value, SingleResultCallback<?> callback)
      Deprecated.
      Throw IllegalArgumentException if the value is null.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • notNull

        public static <T> T notNull​(java.lang.String name,
                                    T value)
        Deprecated.
        Throw IllegalArgumentException if the value is null.
        Type Parameters:
        T - the value type
        Parameters:
        name - the parameter name
        value - the value that should not be null
        Returns:
        the value
        Throws:
        java.lang.IllegalArgumentException - if value is null
      • notNull

        public static <T> T notNull​(java.lang.String name,
                                    T value,
                                    SingleResultCallback<?> callback)
        Deprecated.
        Throw IllegalArgumentException if the value is null.
        Type Parameters:
        T - the value type
        Parameters:
        name - the parameter name
        value - the value that should not be null
        callback - the callback that also is passed the exception if the value is null
        Returns:
        the value
        Throws:
        java.lang.IllegalArgumentException - if value is null
      • isTrue

        public static void isTrue​(java.lang.String name,
                                  boolean condition)
        Deprecated.
        Throw IllegalStateException if the condition if false.
        Parameters:
        name - the name of the state that is being checked
        condition - the condition about the parameter to check
        Throws:
        java.lang.IllegalStateException - if the condition is false
      • isTrue

        public static void isTrue​(java.lang.String name,
                                  boolean condition,
                                  SingleResultCallback<?> callback)
        Deprecated.
        Throw IllegalStateException if the condition if false.
        Parameters:
        name - the name of the state that is being checked
        condition - the condition about the parameter to check
        callback - the callback that also is passed the exception if the condition is not true
        Throws:
        java.lang.IllegalStateException - if the condition is false
      • isTrueArgument

        public static void isTrueArgument​(java.lang.String name,
                                          boolean condition)
        Deprecated.
        Throw IllegalArgumentException if the condition if false.
        Parameters:
        name - the name of the state that is being checked
        condition - the condition about the parameter to check
        Throws:
        java.lang.IllegalArgumentException - if the condition is false
      • doesNotContainNull

        public static void doesNotContainNull​(java.lang.String name,
                                              java.util.Collection<?> collection)
        Deprecated.
        Throw IllegalArgumentException if the collection contains a null value.
        Parameters:
        name - the name of the collection
        collection - the collection
        Throws:
        java.lang.IllegalArgumentException - if the collection contains a null value