public final class AssertUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
require(boolean condition,
String message)
Checks that a condition is accepted and throws a customized
IllegalArgumentException if it is
not. |
static void |
requireNonEmpty(@Nullable String s,
String message)
Checks that a
String is neither null nor empty, and throws a customized
IllegalArgumentException if it is. |
static <T> T |
requireNonNull(T obj,
String message)
Checks that an object is not
null and throws a customized IllegalArgumentException if
it is. |
public static <T> T requireNonNull(@Nullable
T obj,
String message)
null and throws a customized IllegalArgumentException if
it is.T - the type of the reference.obj - the object reference to check for nullity.message - the detail message to be used by thrown IllegalArgumentException.obj if not null.IllegalArgumentException - if obj is null.public static void require(boolean condition,
String message)
IllegalArgumentException if it is
not.condition - if condition accepted.message - the detail message to be used by thrown IllegalArgumentException.IllegalArgumentException - if condition is false.public static void requireNonEmpty(@Nullable
@Nullable String s,
String message)
String is neither null nor empty, and throws a customized
IllegalArgumentException if it is.s - the string to check for empty.message - the detail message to be used by thrown IllegalArgumentException.IllegalArgumentException - if s is null or empty.Copyright © 2018–2024 asyncer.io. All rights reserved.