public class Validate extends Object
| Constructor and Description |
|---|
Validate() |
| Modifier and Type | Method and Description |
|---|---|
static <T> void |
isNotNull(T data,
String name)
Asserts that the argument is not null.
|
static void |
isNotNullOrWhitespace(String x,
String name)
Asserts that the String is not null or purely whitespace.
|
static void |
maxLength(String x,
int max,
String name)
Asserts that the String is not longer than
max. |
static <T> void |
minLength(T[] x,
int min,
String name)
Asserts that the String is not shorter than
max. |
public static void isNotNullOrWhitespace(String x, String name) throws ArgumentNullException
x - the string to validatename - the name of the argument that's being tested.ArgumentNullException - if x is null or whitespace.public static void maxLength(String x, int max, String name) throws InvalidLengthException
max.x - The string to testmax - the maximum lengthname - the name of the argument that's being tested.InvalidLengthException - if x is longer than maxpublic static <T> void minLength(T[] x,
int min,
String name)
throws InvalidLengthException
max.T - the type of the arrayx - The string to testmin - the minimum lengthname - the name of the argument that's being tested.InvalidLengthException - if x is shorter than maxpublic static <T> void isNotNull(T data,
String name)
throws ArgumentNullException
T - the type of the object being testeddata - the object to testname - the name of the argument that's being testedArgumentNullException - if data is nullCopyright © 2016. All rights reserved.