|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ehcache.internal.classes.commonslang.Validate
public class Validate
This class assists in validating arguments. The validation methods are based along the following principles:
null argument causes a NullPointerException.null argument causes an IllegalArgumentException.IndexOutOfBoundsException.All exceptions messages are format strings as defined by the Java platform. For example:
Validate.isTrue(i > 0, "The value must be greater than zero: %d", i); Validate.notNull(surname, "The surname must not be %s", null);
#ThreadSafe#
String.format(String, Object...)| Constructor Summary | |
|---|---|
Validate()
Constructor. |
|
| Method Summary | ||
|---|---|---|
static
|
notNull(T object,
java.lang.String message,
java.lang.Object... values)
Validate that the specified argument is not null;
otherwise throwing an exception with the specified message. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Validate()
| Method Detail |
|---|
public static <T> T notNull(T object,
java.lang.String message,
java.lang.Object... values)
Validate that the specified argument is not null;
otherwise throwing an exception with the specified message.
Validate.notNull(myObject, "The object must not be null");
T - the object typeobject - the object to checkmessage - the String.format(String, Object...) exception message if invalid, not nullvalues - the optional values for the formatted exception message
null for method chaining)
java.lang.NullPointerException - if the object is null#notNull(Object)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||