public class Preconditions extends Object
| Constructor and Description |
|---|
Preconditions() |
| Modifier and Type | Method and Description |
|---|---|
static void |
isUrl(String value,
String message)
Checks that a string is a valid URL.
|
static void |
maxLength(String value,
int maxLength,
String message)
Checks that the length of a string is not greater than
maxLength. |
static void |
notEmpty(String value,
String message)
Checks that a string is not null or empty.
|
static void |
notNull(Object object,
String message)
Checks that an object is not null.
|
public static void notNull(Object object, String message) throws IllegalArgumentException
object - the object to be testedmessage - the message for the exception in case the object is null.IllegalArgumentException - if the object is null.public static void notEmpty(String value, String message) throws IllegalArgumentException
value - the string to be tested.message - the message for the exception in case the string is empty.IllegalArgumentException - if the string is empty.public static void maxLength(String value, int maxLength, String message) throws IllegalArgumentException
maxLength.value - the string to be testedmaxLength - the max lenght of the string.message - the message for the exception in case the length of the string is greater than maxLength.IllegalArgumentException - if the length of the string is greater that maxLength.public static void isUrl(String value, String message) throws IllegalArgumentException
value - the string to be tested.message - the message for the exception in case the string is not a valid URL.IllegalArgumentException - if the string is not a valid URL.Copyright © 2014. All rights reserved.