net.sf.ant4eclipse.lang
Class Assert

java.lang.Object
  extended by net.sf.ant4eclipse.lang.Assert

public class Assert
extends java.lang.Object

Implements utility methods to support design-by-contract. If a condition is evaluated to false, a RuntimeException will be thrown.


Constructor Summary
Assert()
           
 
Method Summary
static void assertTrue(boolean condition, java.lang.String msg)
           Assert that the given condition is true
static void exists(java.io.File file)
           Assert that the specified file is not null and exists.
static void inRange(int value, int from, int to)
           Checks whether a value is in a specific range or not.
static void isDirectory(java.io.File file)
           Assert that the specified file is not null, exists and is a directory.
static void isFile(java.io.File file)
           Assert that the specified file is not null, exists and is a file.
static void nonEmpty(java.lang.String string)
           Assert that the supplied string provides a value or not.
static void notNull(java.lang.Object object)
           Assert that the specified object is not null.
 
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

notNull

public static void notNull(java.lang.Object object)

Assert that the specified object is not null.

Parameters:
object - the object that must be set.

nonEmpty

public static void nonEmpty(java.lang.String string)

Assert that the supplied string provides a value or not.

Parameters:
string - the string that must provide a value.

exists

public static void exists(java.io.File file)

Assert that the specified file is not null and exists.

Parameters:
file - the file that must exist.

isFile

public static void isFile(java.io.File file)

Assert that the specified file is not null, exists and is a file.

Parameters:
file - the file that must be a file.

isDirectory

public static void isDirectory(java.io.File file)

Assert that the specified file is not null, exists and is a directory.

Parameters:
file - the file that must be a directory.

assertTrue

public static void assertTrue(boolean condition,
                              java.lang.String msg)

Assert that the given condition is true

Parameters:
condition - the condition
msg - the message

inRange

public static void inRange(int value,
                           int from,
                           int to)

Checks whether a value is in a specific range or not.

Parameters:
value - the value that shall be tested.
from - the lower bound inclusive.
to - the upper bound inclusive.