List of utility methods to do Assert Not Null
void | assertNotNull(final Object object, final String message) Check that an object is null and throw NullPointerException in the case. if (object == null) { throw new NullPointerException(message == null ? "Object is null" : message); |
void | assertNotNull(final Object object, final String message) Check whether the object is null or not. if (object == null) { throw new IllegalArgumentException(message); |
void | assertNotNull(final Object param, final String name) assert Not Null if (param == null) throw new IllegalArgumentException(String.format("NULL %s", (name != null) ? name : "parameter")); |
void | assertNotNull(final Object value, final String name) Asserts that the parameter's value is not null. if (value == null) { throw new NullPointerException(PREFIX + name + " is null."); |
boolean | assertNotNull(final Object... objects) assert Not Null for (Object obj : objects) { if (obj == null) { return false; return true; |
void | assertNotNull(final String message, final Object obj) assert Not Null if (obj == null) { throw new NullPointerException(message); |
void | assertNotNull(final String message, final Object object) assert Not Null assertTrue(message, object != null); |
T | assertNotNull(final String name, final T object) assert Not Null if (object == null) throw new IllegalArgumentException(String.format("%s == null", name)); return object; |
void | assertNotNull(final String param, final Object value) Asserts that a value is not null .
if (value == null) { throw new IllegalArgumentException(param); |
T | assertNotNull(final T object, final String message) Checks if the given object is null .If it is, a new NullPointerException is thrown with the given message. if (object == null) { throw new NullPointerException(message); return object; |