com.oakgrovesystems.util
Class Assert

java.lang.Object
  |
  +--com.oakgrovesystems.util.Assert

public class Assert
extends java.lang.Object

This class provides static methods for handling assertions, which can be used to enforce pre-conditions and post-conditions in code at a very low level. These are assertions that should never fail, unless there was an error in designing or implementing the software.


Constructor Summary
Assert()
           
 
Method Summary
static void check(boolean assertion, java.lang.String message)
          Throws an AssertionException if the boolean assertion is false.
static void fail(java.lang.String message)
          Currently this just throws an AssertionException.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Assert

public Assert()
Method Detail

fail

public static void fail(java.lang.String message)
Currently this just throws an AssertionException. In case we want to change this behavior, callers should return from their function if it's not appropriate to continue, rather than counting on the exception to break them out of the function.

Parameters:
message - The message to use when constructing the AssertionException.

check

public static void check(boolean assertion,
                         java.lang.String message)
Throws an AssertionException if the boolean assertion is false. Otherwise does nothing.

Parameters:
assertion - The boolean assertion to test. If false, an AssertionException is thrown.
message - The message to use to construct the AssertionException, if one is thrown.


Copyright (c) 1999-2004 Oak Grove Systems. All Rights Reserved.