TUM CCSM Commons

edu.tum.cs.commons.assertion
Class CCSMPre

java.lang.Object
  extended by edu.tum.cs.commons.assertion.CCSMPre

public class CCSMPre
extends java.lang.Object

This class provides simple methods to check preconditions. Please see refer to the package documentation for a discussion of assertions vs preconditions.

Version:
$Rev: 26283 $
Author:
deissenb, $Author: juergens $
Rating:
GREEN Hash: 4BF2AFF0A3284F2E41474F6ADB98344E

Constructor Summary
CCSMPre()
           
 
Method Summary
static void fail(java.lang.String message)
          Throws a PreconditionException with the provided message.
static void isFalse(boolean condition, java.lang.String message)
          Checks if a condition is false.
static void isInstanceOf(java.lang.Object object, java.lang.Class<?> clazz)
          Checks that the object is a instance of the class
static void isNotNull(java.lang.Object reference)
          Checks whether a reference is null.
static void isNotNull(java.lang.Object reference, java.lang.String message)
          Checks whether a reference is null.
static void isTrue(boolean condition, java.lang.String message)
          Checks if a condition is true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CCSMPre

public CCSMPre()
Method Detail

isTrue

public static void isTrue(boolean condition,
                          java.lang.String message)
                   throws PreconditionException
Checks if a condition is true.

Parameters:
condition - condition to check
message - exception message
Throws:
PreconditionException - if the condition is false

isFalse

public static void isFalse(boolean condition,
                           java.lang.String message)
                    throws PreconditionException
Checks if a condition is false.

Parameters:
condition - condition to check
message - exception message
Throws:
PreconditionException - if the condition is true

isInstanceOf

public static void isInstanceOf(java.lang.Object object,
                                java.lang.Class<?> clazz)
Checks that the object is a instance of the class


fail

public static void fail(java.lang.String message)
                 throws PreconditionException
Throws a PreconditionException with the provided message.

Throws:
PreconditionException

isNotNull

public static void isNotNull(java.lang.Object reference)
                      throws java.lang.AssertionError
Checks whether a reference is null.

Parameters:
reference - reference to check
Throws:
java.lang.AssertionError - if the reference is null

isNotNull

public static void isNotNull(java.lang.Object reference,
                             java.lang.String message)
                      throws java.lang.AssertionError
Checks whether a reference is null.

Parameters:
reference - reference to check
message - exception message
Throws:
java.lang.AssertionError - if the reference is null

TUM CCSM Commons

TUM CCSM Commons - 2.7