com.github.fge.jsonschema.core.util
Class ArgumentChecker<T>

java.lang.Object
  extended by com.github.fge.jsonschema.core.util.ArgumentChecker<T>
Type Parameters:
T - type of the argument to check

@Beta
public abstract class ArgumentChecker<T>
extends Object

An argument checker

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.

Since:
1.1.9

Field Summary
protected static MessageBundle BUNDLE
           
 
Constructor Summary
ArgumentChecker()
           
 
Method Summary
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUNDLE

protected static final MessageBundle BUNDLE
Constructor Detail

ArgumentChecker

public ArgumentChecker()
Method Detail

anythingGoes

public static <X> ArgumentChecker<X> anythingGoes()
As its name says

Type Parameters:
X - the type of the argument
Returns:
an argument checker

notNull

public static <X> ArgumentChecker<X> notNull()
An argument checker refusing null arguments; fails with a standard message

Type Parameters:
X - the type of the argument
Returns:
an argument checker

notNull

public static <X> ArgumentChecker<X> notNull(String message)
An argument checker refusing null arguments; fails with a customized message

Type Parameters:
X - the type of the argument
Parameters:
message - the message to fail with
Returns:
an argument checker
Throws:
NullPointerException - message is null

check

public abstract void check(@Nullable
                           T argument)
Check the sanity of an argument

Parameters:
argument - the argument
Throws:
RuntimeException - see description