Package net.adoptopenjdk.icedteaweb
Class Assert
- java.lang.Object
-
- net.adoptopenjdk.icedteaweb.Assert
-
public class Assert extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringNOT_EMPTY_MSG_FORMATprivate static java.lang.StringNOT_NULL_MSG_FORMAT
-
Constructor Summary
Constructors Modifier Constructor Description privateAssert()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringrequireNonBlank(java.lang.String str, java.lang.String argumentName)Checks that the specifiedstrblank, throwsIllegalArgumentExceptionwith a customized error message if it is.static <T> TrequireNonNull(T value, java.lang.String argumentName)Checks that the specifiedvalueis null and throwsNullPointerExceptionwith a customized error message if it is.
-
-
-
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
-
-
Method Detail
-
requireNonNull
public static <T> T requireNonNull(T value, java.lang.String argumentName)Checks that the specifiedvalueis null and throwsNullPointerExceptionwith 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 specifiedstrblank, throwsIllegalArgumentExceptionwith 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- ifstris null.java.lang.IllegalArgumentException- ifstris blank.- See Also:
requireNonNull(Object, String),StringUtils.isBlank(String)
-
-