ERXAssert Class Reference

Collaboration diagram for ERXAssert:

Collaboration graph
[legend]

List of all members.

Classes

class  EmptyHandler
interface  FailureHandler
class  IllegalArgumentHandler
class  IllegalStateHandler
class  LoggingHandler
class  ThrowingHandler

Public Member Functions

void fail (String message, String supplement)
void fail (String message)
FailureHandler failureHandler ()
void greaterThan (double value1, double value2)
void greaterThan (long value1, long value2)
void greaterThan (int value1, int value2)
void greaterThanOrEqual (double value1, double value2)
void greaterThanOrEqual (long value1, long value2)
void greaterThanOrEqual (int value1, int value2)
void isEmpty (String value)
void isEqual (String message, Object value1, Object value2)
void isEqual (Object value1, Object value2)
void isEqual (double value1, double value2)
void isEqual (long value1, long value2)
void isEqual (String message, int value1, int value2)
void isEqual (int value1, int value2)
void isFalse (String message, boolean value)
void isFalse (boolean value)
void isNegative (double value)
void isNegative (long value)
void isNegative (int value)
void isNull (String message, Object value)
void isNull (Object value)
void isPositive (double value)
void isPositive (long value)
void isPositive (int value)
void isTrue (String message, boolean value)
void isTrue (boolean value)
void isZero (double value)
void isZero (long value)
void isZero (int value)
void lessThan (double value1, double value2)
void lessThan (long value1, long value2)
void lessThan (int value1, int value2)
void lessThanOrEqual (double value1, double value2)
void lessThanOrEqual (long value1, long value2)
void lessThanOrEqual (int value1, int value2)
String name ()
void notEmpty (String value)
void notEqual (Object value1, Object value2)
void notEqual (double value1, double value2)
void notEqual (long value1, long value2)
void notEqual (int value1, int value2)
void notNegative (double value)
void notNegative (long value)
void notNegative (int value)
void notNull (String message, Object value)
void notNull (Object value)
void notPositive (double value)
void notPositive (long value)
void notPositive (int value)
void notZero (double value)
void notZero (long value)
void notZero (int value)
void setFailureHandler (FailureHandler handler)
void unknownSwitchCase (int value)

Static Public Member Functions

static ERXAssert getAssert (String prefix, Class c)
static ERXAssert getAssert (Class c)
static ERXAssert getAssert (String name)
static void setHandlerForLevel (FailureHandler object, String level)

Static Public Attributes

static final ERXAssert DURING
static final ERXAssert POST
static final ERXAssert PRE

Static Protected Member Functions

static String getLevel (ERXAssert value)
static void setLevel (ERXAssert value)

Protected Attributes

FailureHandler _failureHandler
String _name

Static Package Functions

 [static initializer]

Private Member Functions

 ERXAssert (String value)

Static Private Attributes

static final NSMutableDictionary _handlersForKey = new NSMutableDictionary()
static final NSMutableDictionary _instances = new NSMutableDictionary()
static final Logger log = Logger.getLogger(ERXAssert.class)


Detailed Description

Provides flexible and powerful assertion. Is modeled a bit like log4j in that you can have multiple asserters that can have different behavior. In particular, each can be disabled, set to logging mode or set to raise an exception. Also you can set your own failure handler.

In WebObjects.properties, you can have:

ERXAssert.instances=RAISE ERXAssert.instances.com.somepackage=LOG ERXAssert.instances.com.somepackage.someclass=RAISE

In your code's static initialization, you can write:

private static ERXAssert Assert = ERXAssert.getAssert(Foo.class); private static ERXAssert Pre = ERXAssert.PRE; private static ERXAssert Post = ERXAssert.POST;

And finally, in your methods, you call it via:

Pre.notNull(someObject); Assert.notNull("someObject" ,someObject); Post.notNull(someObject);

or you can use the supplied assertors directly

ERXAssert.DURING.notNull("someObject", someObject);

Most of this code is derived from Jonathan "Wolf" Rentzsch's JAssert, which can be found here: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/redshed/JAssert/


Constructor & Destructor Documentation

ERXAssert ( String  value  )  [private]


Member Function Documentation

[static initializer] (  )  [static, package]

void fail ( String  message,
String  supplement 
)

void fail ( String  message  ) 

FailureHandler failureHandler (  ) 

static ERXAssert getAssert ( String  prefix,
Class  c 
) [static]

static ERXAssert getAssert ( Class  c  )  [static]

static ERXAssert getAssert ( String  name  )  [static]

static String getLevel ( ERXAssert  value  )  [static, protected]

void greaterThan ( double  value1,
double  value2 
)

void greaterThan ( long  value1,
long  value2 
)

void greaterThan ( int  value1,
int  value2 
)

void greaterThanOrEqual ( double  value1,
double  value2 
)

void greaterThanOrEqual ( long  value1,
long  value2 
)

void greaterThanOrEqual ( int  value1,
int  value2 
)

void isEmpty ( String  value  ) 

void isEqual ( String  message,
Object  value1,
Object  value2 
)

void isEqual ( Object  value1,
Object  value2 
)

void isEqual ( double  value1,
double  value2 
)

void isEqual ( long  value1,
long  value2 
)

void isEqual ( String  message,
int  value1,
int  value2 
)

void isEqual ( int  value1,
int  value2 
)

void isFalse ( String  message,
boolean  value 
)

void isFalse ( boolean  value  ) 

void isNegative ( double  value  ) 

void isNegative ( long  value  ) 

void isNegative ( int  value  ) 

void isNull ( String  message,
Object  value 
)

void isNull ( Object  value  ) 

void isPositive ( double  value  ) 

void isPositive ( long  value  ) 

void isPositive ( int  value  ) 

void isTrue ( String  message,
boolean  value 
)

void isTrue ( boolean  value  ) 

void isZero ( double  value  ) 

void isZero ( long  value  ) 

void isZero ( int  value  ) 

void lessThan ( double  value1,
double  value2 
)

void lessThan ( long  value1,
long  value2 
)

void lessThan ( int  value1,
int  value2 
)

void lessThanOrEqual ( double  value1,
double  value2 
)

void lessThanOrEqual ( long  value1,
long  value2 
)

void lessThanOrEqual ( int  value1,
int  value2 
)

String name (  ) 

void notEmpty ( String  value  ) 

void notEqual ( Object  value1,
Object  value2 
)

void notEqual ( double  value1,
double  value2 
)

void notEqual ( long  value1,
long  value2 
)

void notEqual ( int  value1,
int  value2 
)

void notNegative ( double  value  ) 

void notNegative ( long  value  ) 

void notNegative ( int  value  ) 

void notNull ( String  message,
Object  value 
)

void notNull ( Object  value  ) 

void notPositive ( double  value  ) 

void notPositive ( long  value  ) 

void notPositive ( int  value  ) 

void notZero ( double  value  ) 

void notZero ( long  value  ) 

void notZero ( int  value  ) 

void setFailureHandler ( FailureHandler  handler  ) 

static void setHandlerForLevel ( FailureHandler  object,
String  level 
) [static]

static void setLevel ( ERXAssert  value  )  [static, protected]

void unknownSwitchCase ( int  value  ) 


Member Data Documentation

final NSMutableDictionary _handlersForKey = new NSMutableDictionary() [static, private]

final NSMutableDictionary _instances = new NSMutableDictionary() [static, private]

String _name [protected]

final ERXAssert DURING [static]

final Logger log = Logger.getLogger(ERXAssert.class) [static, private]

final ERXAssert POST [static]

final ERXAssert PRE [static]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:12 2012 for Project Wonder by  doxygen 1.5.8