home *** CD-ROM | disk | FTP | other *** search
- package com.commerceone.util.contract;
-
- public class Contract {
- public static final boolean REQUIRE = true;
- public static final boolean ENSURE = true;
- public static final boolean CHECK = true;
-
- public static void require(boolean expr) throws ProgrammerError {
- if (!expr) {
- throw new ProgrammerError("REQUIRE");
- }
- }
-
- public static void require(boolean expr, String msg) throws ProgrammerError {
- if (!expr) {
- throw new ProgrammerError("REQUIRE: " + msg);
- }
- }
-
- public static void ensure(boolean expr) throws ProgrammerError {
- if (!expr) {
- throw new ProgrammerError("ENSURE");
- }
- }
-
- public static void ensure(boolean expr, String msg) throws ProgrammerError {
- if (!expr) {
- throw new ProgrammerError("ENSURE:" + msg);
- }
- }
-
- public static void check(boolean expr) throws ProgrammerError {
- if (!expr) {
- throw new ProgrammerError("CHECK");
- }
- }
-
- public static void check(boolean expr, String msg) throws ProgrammerError {
- if (!expr) {
- throw new ProgrammerError("CHECK: " + msg);
- }
- }
- }
-