public class Preconditions extends Object
| Constructor and Description |
|---|
Preconditions() |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkArgument(boolean check,
String valueName)
Checks that the argument is valid, based in a check boolean condition.
|
static String |
checkNotEmpty(String value,
String valueName)
Checks that the String is not null and not empty
|
static <T> T |
checkNotNull(T value,
String valueName)
Checks that the argument is not null.
|
static int |
gt0(int value,
String valueName)
Checks that the integer argument is positive.
|
public static <T> T checkNotNull(T value,
String valueName)
throws IllegalArgumentException
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 nullpublic static String checkNotEmpty(String value, String valueName) throws IllegalArgumentException
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,
String valueName)
throws IllegalArgumentException
check - The boolean checkvalueName - The name of the value that is checked in the methodIllegalArgumentExceptionpublic static int gt0(int value,
String valueName)
throws IllegalArgumentException
value - The value to be checkedvalueName - The name of the value that is checked in the methodIllegalArgumentException - If value is nullCopyright © 2017–2020. All rights reserved.