Class Assertions


  • public final class Assertions
    extends Object
    • Method Detail

      • nullCheck

        public static void nullCheck​(Object o,
                                     String param)
        Throws NullPointerException if the parameter o is null.
        Parameters:
        o - check if the object is null.
        param - name of the parameter to check for null.
        Throws:
        NullPointerException - if o is null and constructs a message with the name of the parameter.
      • nullChecked

        public static <T> T nullChecked​(T o,
                                        String param)
        Throws NullPointerException if the parameter o is null, otherwise returns the value of the o parameter.
        Type Parameters:
        T - the type of the value
        Parameters:
        o - check if the object is null.
        param - name of the parameter to check for null.
        Returns:
        the value of the o parameter.
        Throws:
        NullPointerException - if o is null and constructs a message with the name of the parameter.
        Since:
        1.1
      • blankCheck

        public static void blankCheck​(String o,
                                      String param)
        Throws IllegalArgumentException if the parameter o is null or blank.
        Parameters:
        o - value to test for blank.
        param - name of the parameter to check.
      • blankChecked

        public static String blankChecked​(String o,
                                          String param)
        Throws IllegalArgumentException if the parameter o is null or blank, otherwise returns the value of the o parameter.
        Parameters:
        o - value to test for blank.
        param - name of the parameter to check.
        Returns:
        the value of the o parameter.
        Since:
        1.1