Service Activator Toolkit
Version 1.1.0 (20081206)

org.eclipse.soda.sat.core.util
Class Assertion

java.lang.Object
  extended by org.eclipse.soda.sat.core.util.Assertion

public final class Assertion
extends Object

The Assertion class provides static method for common assertions.


Method Summary
static void checkArgumentIsNotNull(Object value, String name)
          Check whether the specified value argument is not null.
static void checkArrayIsNotEmpty(Object value, String name)
          Check whether the specified array is not empty.
static void checkIsNotNull(Object value, String messageKey)
          Check whether the specified value is not null.
static void checkIsNotNull(Object value, String messageKey, Object messageParameter)
          Check whether the specified value is not null.
static void checkRange(long value, String name, long beginRange, long endRange)
          Check whether the specified value is with the specified begin and end range.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkArgumentIsNotNull

public static void checkArgumentIsNotNull(Object value,
                                          String name)
                                   throws IllegalArgumentException
Check whether the specified value argument is not null.

Parameters:
value - An Object that must not be null.
name - The name of the argument.
Throws:
IllegalArgumentException - when the argument is null.

checkArrayIsNotEmpty

public static void checkArrayIsNotEmpty(Object value,
                                        String name)
                                 throws IllegalArgumentException
Check whether the specified array is not empty.

Parameters:
value - An Object[] that must not be empty.
name - The name of the argument.
Throws:
IllegalArgumentException - when the array is empty.

checkIsNotNull

public static void checkIsNotNull(Object value,
                                  String messageKey)
                           throws IllegalArgumentException
Check whether the specified value is not null. If the value is null, display the message associated with the specified message key.

Parameters:
value - An Object that must not be null.
messageKey - The key of a message to display if the value is null.
Throws:
IllegalArgumentException - when the value is null.

checkIsNotNull

public static void checkIsNotNull(Object value,
                                  String messageKey,
                                  Object messageParameter)
                           throws IllegalArgumentException
Check whether the specified value is not null. If the value is null, display the message associated with the specified message key and message parameter.

Parameters:
value - An Object that must not be null.
messageKey - The key of a message to display if the value is null.
messageParameter - The value to replace {0} place holder in the message.
Throws:
IllegalArgumentException - when the value is null.

checkRange

public static void checkRange(long value,
                              String name,
                              long beginRange,
                              long endRange)
                       throws IllegalArgumentException
Check whether the specified value is with the specified begin and end range.

Parameters:
value - An number.
name - The name for the number.
beginRange - The begin range.
endRange - The end range.
Throws:
IllegalArgumentException - when the value is not within the begin and end range.

Service Activator Toolkit
Version 1.1.0 (20081206)