|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.elibom.client.Preconditions
public class Preconditions
This class provides helper methods to check preconditions throwing an exception when not met.
| Constructor Summary | |
|---|---|
Preconditions()
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Preconditions()
| Method Detail |
|---|
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.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||