|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.mcdermottroe.exemplar.DBC
public final class DBC
Provide some rudimentary Design By Contract™ facilities. This class attempts to mimic the Design By Contract™ mechanisms present in Eiffel. It would be nice to have invariants as well, but that would require more language support. If only Java™ had Design By Contract™ built in or if Eiffel didn't have hideous syntax!
| Constructor Summary | |
|---|---|
private |
DBC()
Prevent this class from being externally instantiated. |
| Method Summary | |
|---|---|
static void |
ASSERT(boolean assertion)
An assertion mechanism which does more than the assert
keyword found in Java version 1.4 and later. |
static void |
ENSURE(boolean postcondition)
Alias of ASSERT(boolean) for describing a postcondition for a
method. |
static void |
IGNORED_EXCEPTION(Throwable t)
A marker for an ignored exception. |
static void |
REQUIRE(boolean precondition)
Alias of ASSERT(boolean) for describing a precondition for a
method. |
static void |
UNREACHABLE_CODE()
A marker for unreachable code. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
private DBC()
| Method Detail |
|---|
public static void ASSERT(boolean assertion)
assert
keyword found in Java version 1.4 and later. This assertion mechanism
includes information on where the assertion was thrown from.
assertion - The boolean expression which should be true.Options.isDebugSet()public static void REQUIRE(boolean precondition)
ASSERT(boolean) for describing a precondition for a
method.
precondition - The condition which must be true at the start
of a routine.ASSERT(boolean)public static void ENSURE(boolean postcondition)
ASSERT(boolean) for describing a postcondition for a
method.
postcondition - The condition which must be true at the end of
a routine.ASSERT(boolean)public static void UNREACHABLE_CODE()
default case of a switch statement
switching on an enumerated type.
ASSERT(boolean)public static void IGNORED_EXCEPTION(Throwable t)
t - The exception to be ignored.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||