org.axonframework.util
Class Assert

java.lang.Object
  extended by org.axonframework.util.Assert

public abstract class Assert
extends Object

Utility class (inspired by Springs Assert class) for doing assertions on parameters and object state. To remove the need for explicit dependencies on Spring, the functionality of that class is migrated to this class.

Since:
0.3
Author:
Allard Buijze

Method Summary
static void isTrue(boolean expression, String message)
          Asserts that the given expression is true.
static void notNull(Object value, String message)
          Assert that the given value is not null.
static void state(boolean state, String message)
          Asserts that the value of state is true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

state

public static void state(boolean state,
                         String message)
Asserts that the value of state is true. If not, an IllegalStateException is thrown.

Parameters:
state - the state validation expression
message - The message that the excetion contains if state evaluates to false

isTrue

public static void isTrue(boolean expression,
                          String message)
Asserts that the given expression is true. If not, an IllegalArgumentException is thrown.

Parameters:
expression - the state validation expression
message - The message that the exception contains if state evaluates to false

notNull

public static void notNull(Object value,
                           String message)
Assert that the given value is not null. If not, an IllegalArgumentException is thrown.

Parameters:
value - the value not to be null
message - The message to add to the exception when the assertion fails


Copyright © 2011. All Rights Reserved.