public final class OWLAPIPreconditions extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
checkIterableNotNull(Collection<?> o,
String name,
boolean emptyAllowed) |
static void |
checkIterableNotNull(Object[] o,
String name,
boolean emptyAllowed) |
static void |
checkNotNegative(long object)
Check for negative value and throw IllegalArgumentException if negative.
|
static void |
checkNotNegative(long object,
String message)
Check for negative value and throw IllegalArgumentException if negative.
|
static void |
checkNotNegative(long object,
Supplier<String> message)
Check for negative value and throw IllegalArgumentException if negative.
|
static <T> T |
checkNotNull(Optional<T> object,
String message)
Deprecated.
|
static <T> T |
checkNotNull(Optional<T> object,
Supplier<String> message)
Check for absent and throw IllegalArgumentException if null or absent.
|
static <T> T |
checkNotNull(T object)
Check for null and throw NullPointerException if null.
|
static <T> T |
checkNotNull(T object,
String message)
Check for null and throw NullPointerException if null.
|
static <T> T |
checkNotNull(T object,
Supplier<String> message)
Check for null and throw NullPointerException if null.
|
static <T> Optional<T> |
emptyOptional()
Wrapper to allow non null annotations.
|
static <T> Optional<T> |
emptyOptional(Class<T> t)
Wrapper to allow non null annotations.
|
static <T> Optional<T> |
optional(T t)
Wrapper to allow non null annotations.
|
static <T> T |
verifyNotNull(T object)
Check that the argument is not null; if the argument is null, throw an
IllegalStateException.
|
static <T> T |
verifyNotNull(T object,
String message)
Check that the argument is not null; if the argument is null, throw an
IllegalStateException.
|
static <T> T |
verifyNotNull(T object,
Supplier<String> message)
Check that the argument is not null; if the argument is null, throw an
IllegalStateException.
|
public static <T> T verifyNotNull(@Nullable T object)
T - reference typeobject - reference to checkIllegalStateException - if object is nullpublic static <T> T verifyNotNull(@Nullable T object, String message)
T - reference typeobject - reference to checkmessage - message to use for the errorIllegalStateException - if object is nullpublic static <T> T verifyNotNull(@Nullable T object, Supplier<String> message)
T - reference typeobject - reference to checkmessage - message to use for the errorIllegalStateException - if object is nullpublic static <T> T checkNotNull(@Nullable T object)
T - reference typeobject - reference to checkNullPointerException - if object is nullpublic static <T> T checkNotNull(@Nullable T object, String message)
T - reference typeobject - reference to checkmessage - message for the illegal argument exceptionNullPointerException - if object is nullpublic static <T> T checkNotNull(@Nullable T object, Supplier<String> message)
T - reference typeobject - reference to checkmessage - message for the illegal argument exceptionNullPointerException - if object is nullpublic static void checkNotNegative(@Nonnegative long object)
object - value to checkIllegalArgumentException - if object is negativepublic static void checkNotNegative(@Nonnegative long object, String message)
object - value to checkmessage - message for the illegal argument exceptionIllegalArgumentException - if object is negativepublic static void checkNotNegative(@Nonnegative long object, Supplier<String> message)
object - value to checkmessage - message for the illegal argument exceptionIllegalArgumentException - if object is negative@Deprecated public static <T> T checkNotNull(@Nullable Optional<T> object, String message)
checkNotNull(Object, Supplier)T - reference typeobject - reference to checkmessage - message for the illegal argument exceptionIllegalArgumentException - if object is nullpublic static <T> T checkNotNull(@Nullable Optional<T> object, Supplier<String> message)
T - reference typeobject - reference to checkmessage - message for the illegal argument exceptionIllegalArgumentException - if object is nullpublic static void checkIterableNotNull(@Nullable Collection<?> o, String name, boolean emptyAllowed)
o - collection to check for nullness and null elements, and optionally for emptinessname - message for erroremptyAllowed - true if the input can be emptypublic static void checkIterableNotNull(Object[] o, String name, boolean emptyAllowed)
o - array to check for nullness and null elements, and optionally for emptinessname - message for erroremptyAllowed - true if the input can be emptypublic static <T> Optional<T> emptyOptional()
public static <T> Optional<T> emptyOptional(Class<T> t)
t - type for the returned optionalCopyright © 2017 The University of Manchester. All rights reserved.