public class ValidationUtils
extends java.lang.Object
构造器和说明 |
---|
ValidationUtils() |
限定符和类型 | 方法和说明 |
---|---|
static void |
assertAllAreNull(java.lang.String messageIfNull,
java.lang.Object... objects)
Asserts that all of the objects are null.
|
static int |
assertIsPositive(int num,
java.lang.String fieldName)
Asserts that the given number is positive (non-negative and non-zero).
|
static <T> T[] |
assertNotEmpty(T[] array,
java.lang.String fieldName) |
static <T extends java.util.Collection<?>> |
assertNotEmpty(T collection,
java.lang.String fieldName) |
static <T> T |
assertNotNull(T object,
java.lang.String fieldName)
Asserts that the given object is non-null and returns it.
|
static java.lang.String |
assertStringNotEmpty(java.lang.String string,
java.lang.String fieldName) |
public static <T> T assertNotNull(T object, java.lang.String fieldName) throws java.lang.IllegalArgumentException
object
- Object to assert onfieldName
- Field name to display in exception message if nulljava.lang.IllegalArgumentException
public static void assertAllAreNull(java.lang.String messageIfNull, java.lang.Object... objects) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static int assertIsPositive(int num, java.lang.String fieldName)
num
- Number to validatefieldName
- Field name to display in exception message if not positive.public static <T extends java.util.Collection<?>> T assertNotEmpty(T collection, java.lang.String fieldName) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static <T> T[] assertNotEmpty(T[] array, java.lang.String fieldName) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static java.lang.String assertStringNotEmpty(java.lang.String string, java.lang.String fieldName) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException