public final class Preconditions extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
castNonNull(T ref) |
static void |
checkArgument(boolean check,
@NotNull String valueName)
Checks that the argument is valid, based in a check boolean condition.
|
static void |
checkArgument(boolean check,
@NotNull String valueName,
@NotNull String errMsg)
Checks that the argument is valid, based in a check boolean condition.
|
static char[] |
checkNotEmpty(char[] value,
@NotNull String valueName)
Checks that the char[] is not null and not empty.
|
static @NotNull String |
checkNotEmpty(@NotNull String value,
@NotNull String valueName)
Checks that the String is not null and not empty.
|
static <T> T |
checkNotNull(T value,
@NotNull String valueName)
Checks that the argument is not null.
|
static int |
gt0(int value,
@NotNull String valueName)
Checks that the integer argument is positive.
|
static boolean |
isNullOrEmpty(@Nullable String string)
Returns
true if the given string is null or is the empty string. |
@NotNull
public static <T> T checkNotNull(@Nullable
T value,
@NotNull
@NotNull String valueName)
T - The type of the valuevalue - The value to be checkedvalueName - The name of the value that is checked in the methodIllegalArgumentException - If value is null.@NotNull
public static <T> T castNonNull(@Nullable
T ref)
@NotNull public static @NotNull String checkNotEmpty(@NotNull @NotNull String value, @NotNull @NotNull String valueName)
value - The String to checkvalueName - The name of the value that is checked in the methodIllegalArgumentException - If value is null or emptypublic static char[] checkNotEmpty(char[] value,
@NotNull
@NotNull String valueName)
value - The String to checkvalueName - The name of the value that is checked in the methodIllegalArgumentException - If value is null or emptypublic static void checkArgument(boolean check,
@NotNull
@NotNull String valueName)
check - The boolean checkvalueName - The name of the value that is checked in the methodIllegalArgumentException - if check is not validpublic static void checkArgument(boolean check,
@NotNull
@NotNull String valueName,
@NotNull
@NotNull String errMsg)
check - The boolean checkvalueName - The name of the value that is checked in the methoderrMsg - Detail of the error messageIllegalArgumentException - if check is not validpublic static int gt0(int value,
@NotNull
@NotNull String valueName)
value - The value to be checkedvalueName - The name of the value that is checked in the methodIllegalArgumentException - If value is equal or less than 0public static boolean isNullOrEmpty(@Nullable
@Nullable String string)
true if the given string is null or is the empty string.string - a String reference to checktrue if the string is null or the string is emptyCopyright © 2017–2025 OnGres, Inc. All rights reserved.