T - type of the argument to check@Beta public abstract class ArgumentChecker<T> extends Object
The only method of this interface returns nothing; it is supposed to throw
a RuntimeException or derivate if the argument supplied is not legal.
Typically, this will be IllegalArgumentException or, if you disallow
null arguments, NullPointerException.
Note that the argument to check may be null.
| Modifier and Type | Field and Description |
|---|---|
protected static MessageBundle |
BUNDLE |
| Constructor and Description |
|---|
ArgumentChecker() |
| Modifier and Type | Method and Description |
|---|---|
static <X> ArgumentChecker<X> |
anythingGoes()
As its name says
|
abstract void |
check(T argument)
Check the sanity of an argument
|
static <X> ArgumentChecker<X> |
notNull()
An argument checker refusing null arguments; fails with a standard
message
|
static <X> ArgumentChecker<X> |
notNull(String message)
An argument checker refusing null arguments; fails with a customized
message
|
protected static final MessageBundle BUNDLE
public static <X> ArgumentChecker<X> anythingGoes()
X - the type of the argumentpublic static <X> ArgumentChecker<X> notNull()
X - the type of the argumentpublic static <X> ArgumentChecker<X> notNull(String message)
X - the type of the argumentmessage - the message to fail withNullPointerException - message is nullpublic abstract void check(@Nullable T argument)
argument - the argumentRuntimeException - see description