public class Preconditions
extends java.lang.Object
Constructor and Description |
---|
Preconditions() |
Modifier and Type | Method and Description |
---|---|
static void |
checkArgument(boolean check,
java.lang.String valueName)
Checks that the argument is valid, based in a check boolean condition.
|
static java.lang.String |
checkNotEmpty(java.lang.String value,
java.lang.String valueName)
Checks that the String is not null and not empty
|
static <T> T |
checkNotNull(T value,
java.lang.String valueName)
Checks that the argument is not null.
|
static int |
gt0(int value,
java.lang.String valueName)
Checks that the integer argument is positive.
|
public static <T> T checkNotNull(T value, java.lang.String valueName) throws java.lang.IllegalArgumentException
T
- The type of the valuevalue
- The value to be checkedvalueName
- The name of the value that is checked in the methodjava.lang.IllegalArgumentException
- If value is nullpublic static java.lang.String checkNotEmpty(java.lang.String value, java.lang.String valueName) throws java.lang.IllegalArgumentException
value
- The String to checkvalueName
- The name of the value that is checked in the methodjava.lang.IllegalArgumentException
- If value is null or emptypublic static void checkArgument(boolean check, java.lang.String valueName) throws java.lang.IllegalArgumentException
check
- The boolean checkvalueName
- The name of the value that is checked in the methodjava.lang.IllegalArgumentException
public static int gt0(int value, java.lang.String valueName) throws java.lang.IllegalArgumentException
value
- The value to be checkedvalueName
- The name of the value that is checked in the methodjava.lang.IllegalArgumentException
- If value is null