public final class NullCheck
extends java.lang.Object
Functions for enforcing non-nullable references at run time.
The functions are intended for use in the manner of assertions. That is,
the program should behave identically if all of the checks are removed. The
functions raise NullCheckException to indicate that a null
reference has been explicitly forbidden (rather than the accidental
deference implied by NullPointerException). Exceptions of this type
are not intended to be caught and handled; they indicate program
bugs.
NullCheckException| Modifier and Type | Method | Description |
|---|---|---|
static <T> T |
notNull(T x) |
Deprecated.
|
static <T> T |
notNull(T x,
java.lang.String message) |
|
static <T,U extends java.util.Collection<T>> |
notNullAll(U x) |
Deprecated.
|
static <T,U extends java.util.Collection<T>> |
notNullAll(U x,
java.lang.String message) |
Check that
x is not null, and that all elements of
x are not null, raising NullCheckException iff
x == null. |
@Deprecated @NonNull public static <T> T notNull(@Nullable T x)
notNull(Object, String)T - The type of valuesx - An arbitrary valuex@NonNull public static <T> T notNull(@Nullable T x, @NonNull java.lang.String message)
T - The type of valuesx - An arbitrary valuemessage - A descriptive message describing the valuex@Deprecated @NonNull public static <T,U extends java.util.Collection<T>> U notNullAll(@Nullable U x)
notNullAll(Collection, String)x is not null, and that all elements of
x are not null, raising NullCheckException iff
x == null.T - The type of valuesU - The type of collections of Tx - An arbitrary valuex@NonNull public static <T,U extends java.util.Collection<T>> U notNullAll(@Nullable U x, @NonNull java.lang.String message)
x is not null, and that all elements of
x are not null, raising NullCheckException iff
x == null.T - The type of valuesU - The type of collections of Tx - An arbitrary valuemessage - A descriptive message describing the valuexCopyright © 2017 <code@io7m.com> http://io7m.com