|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.metrics2.util.Contracts
public class Contracts
Utilities for programming by contract (preconditions, postconditions etc.)
Method Summary | ||
---|---|---|
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
|
checkArg(T arg,
boolean expression,
Object msg)
Check an argument for false conditions |
|
static
|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> T checkNotNull(T ref, Object msg)
T
- type of the referenceref
- the reference to checkmsg
- the error message
NullPointerException
- if ref
is nullpublic static void checkState(boolean expression, Object msg)
expression
- the boolean expression to checkmsg
- the error message if expression
is false
IllegalStateException
- 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 false
public 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 false
public 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 false
public 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 false
public 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 false
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |