Class Assert


  • public class Assert
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Assert()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String requireNonBlank​(java.lang.String str, java.lang.String argumentName)
      Checks that the specified str blank, throws IllegalArgumentException with a customized error message if it is.
      static <T> T requireNonNull​(T value, java.lang.String argumentName)
      Checks that the specified value is null and throws NullPointerException with a customized error message if it is.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NOT_NULL_MSG_FORMAT

        private static final java.lang.String NOT_NULL_MSG_FORMAT
        See Also:
        Constant Field Values
      • NOT_EMPTY_MSG_FORMAT

        private static final java.lang.String NOT_EMPTY_MSG_FORMAT
        See Also:
        Constant Field Values
    • Constructor Detail

      • Assert

        private Assert()
    • Method Detail

      • requireNonNull

        public static <T> T requireNonNull​(T value,
                                           java.lang.String argumentName)
        Checks that the specified value is null and throws NullPointerException with a customized error message if it is.
        Type Parameters:
        T - type of the value
        Parameters:
        value - the value to be checked.
        argumentName - the name of the argument to be used in the error message.
        Returns:
        the value.
      • requireNonBlank

        public static java.lang.String requireNonBlank​(java.lang.String str,
                                                       java.lang.String argumentName)
        Checks that the specified str blank, throws IllegalArgumentException with a customized error message if it is.
        Parameters:
        str - the value to be checked.
        argumentName - the name of the argument to be used in the error message.
        Returns:
        the str.
        Throws:
        java.lang.NullPointerException - if str is null.
        java.lang.IllegalArgumentException - if str is blank.
        See Also:
        requireNonNull(Object, String), StringUtils.isBlank(String)