public class MustBe
extends java.lang.Object
| Constructor and Description |
|---|
MustBe() |
| Modifier and Type | Method and Description |
|---|---|
static void |
empty(java.util.Collection<?> collection,
java.lang.String name)
Throws an exception if the specified collection is not empty.
|
static void |
falseValue(boolean value,
java.lang.String name)
Throws an exception if the specified value is not false.
|
static void |
inRange(int value,
java.lang.String name,
int minInclusive,
int maxInclusive)
Throws an exception if the specified integer value is not in the specified inclusive range.
|
static void |
inRange(long value,
java.lang.String name,
long minInclusive,
long maxInclusive)
Throws an exception if the specified long value is not in the specified inclusive range.
|
static void |
match(java.lang.String str,
java.lang.String name,
java.util.regex.Pattern pattern,
int maxLength)
Throws an exception if the specified string does not match the pattern, is empty, or longer than the max length.
|
static void |
notNull(java.lang.Object obj,
java.lang.String name)
Throws an exception if the specified object is null.
|
static void |
notWhitespace(java.lang.String str,
java.lang.String name,
int maxLength)
Throws an exception if the specified string contains no non-whitespace characters.
|
static void |
trueValue(boolean value,
java.lang.String name)
Throws an exception if the specified value is not true.
|
public static void notNull(java.lang.Object obj,
java.lang.String name)
obj - The object.name - The object name.public static void notWhitespace(java.lang.String str,
java.lang.String name,
int maxLength)
str - The string.name - The string name.maxLength - The max length.public static void match(java.lang.String str,
java.lang.String name,
java.util.regex.Pattern pattern,
int maxLength)
str - The string.name - The string name.pattern - The pattern to match.maxLength - The max length.public static void inRange(int value,
java.lang.String name,
int minInclusive,
int maxInclusive)
value - The integer value.name - The value name.minInclusive - The min allowed value (inclusive).maxInclusive - The max allowed value (inclusive).public static void inRange(long value,
java.lang.String name,
long minInclusive,
long maxInclusive)
value - The long value.name - The value name.minInclusive - The min allowed value (inclusive).maxInclusive - The max allowed value (inclusive).public static void empty(java.util.Collection<?> collection,
java.lang.String name)
collection - The collection.name - The collection name.public static void trueValue(boolean value,
java.lang.String name)
value - The value.name - The value name.public static void falseValue(boolean value,
java.lang.String name)
value - The value.name - The value name.