Java Utililty Methods Assert Not Null

List of utility methods to do Assert Not Null

Description

The list of methods to do Assert Not Null are organized into topic(s).

Method

voidassertNotNull(Object object)
assert Not Null
assertNotNull(null, object);
voidassertNotNull(Object object, RuntimeException cause)
assert Not Null
if (object == null) {
    cause.initCause(cause.getCause());
    throw cause;
voidassertNotNull(Object object, String description)
Throws an NPE if the given object is null that uses the specified text to describe the object.
if (object == null) {
    throw new NullPointerException("The " + description + " must not be null.");
voidassertNotNull(Object object, String message)
assert Not Null
if (isNull(object)) {
    throw new IllegalArgumentException(message);
voidassertNotNull(Object object, String message)
assert Not Null
if (object == null)
    error(message);
voidassertNotNull(Object object, String message)
assert Not Null
if (object == null) {
    throw new NullPointerException(message);
voidassertNotNull(Object object, String param)
Asserts that the given object with name param is not null, throws IllegalArgumentException otherwise.
if (object == null) {
    throw new IllegalArgumentException(String.format("%s may not be null.", param));
voidassertNotNull(Object val)
assert Not Null
if (val == null) {
    throw new AssertionError("val is null");
voidassertNotNull(Object value)
assert Not Null
assert value != null : "Expression must be checked before applying transformation";
voidassertNotNull(Object... objects)
Throw an IllegalArgumentException if any of the given objects are null
assertNotNull("Null argument not allowed", objects);