public class ValidationUtils extends Object
构造器和说明 |
---|
ValidationUtils() |
限定符和类型 | 方法和说明 |
---|---|
static int |
assertIsPositive(int num,
String fieldName)
Asserts that the given number is positive (non-negative and non-zero).
|
static <T> T |
assertNotNull(T object,
String fieldName)
Asserts that the given object is non-null and returns it.
|
public static int assertIsPositive(int num, String fieldName)
num
- Number to validatefieldName
- Field name to display in exception message if not positive.public static <T> T assertNotNull(T object, String fieldName) throws IllegalArgumentException
object
- Object to assert onfieldName
- Field name to display in exception message if nullIllegalArgumentException
- If object was nullCopyright © 2020. All rights reserved.