public class Contracts extends Object
限定符和类型 | 方法和说明 |
---|---|
static double |
checkArg(double arg,
boolean expression,
Object msg)
Check an argument for false conditions
|
static float |
checkArg(float arg,
boolean expression,
Object msg)
Check an argument for false conditions
|
static int |
checkArg(int arg,
boolean expression,
Object msg)
Check an argument for false conditions
|
static long |
checkArg(long arg,
boolean expression,
Object msg)
Check an argument for false conditions
|
static <T> T |
checkArg(T arg,
boolean expression,
Object msg)
Check an argument for false conditions
|
static <T> T |
checkNotNull(T ref,
Object msg)
Check that a reference is not null.
|
static void |
checkState(boolean expression,
Object msg)
Check the state expression for false conditions
|
public static <T> T checkNotNull(T ref, Object msg)
T
- type of the referenceref
- the reference to checkmsg
- the error messageNullPointerException
- if ref
is nullpublic static void checkState(boolean expression, Object msg)
expression
- the boolean expression to checkmsg
- the error message if expression
is falseIllegalStateException
- if expression
is falsepublic static <T> T checkArg(T arg, boolean expression, Object msg)
T
- type of the argumentarg
- the argument to checkexpression
- the boolean expression for the conditionmsg
- the error message if expression
is falsepublic static int checkArg(int arg, boolean expression, Object msg)
arg
- the argument to checkexpression
- the boolean expression for the conditionmsg
- the error message if expression
is falsepublic static long checkArg(long arg, boolean expression, Object msg)
arg
- the argument to checkexpression
- the boolean expression for the conditionmsg
- the error message if expression
is falsepublic static float checkArg(float arg, boolean expression, Object msg)
arg
- the argument to checkexpression
- the boolean expression for the conditionmsg
- the error message if expression
is falsepublic static double checkArg(double arg, boolean expression, Object msg)
arg
- the argument to checkexpression
- the boolean expression for the conditionmsg
- the error message if expression
is falseCopyright © 2009 The Apache Software Foundation