
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) |
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/
| [static initializer] | ( | ) | [static, package] |
| void fail | ( | String | message | ) |
| FailureHandler failureHandler | ( | ) |
| static ERXAssert getAssert | ( | Class | c | ) | [static] |
| 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 | ) |
FailureHandler _failureHandler [protected] |
final NSMutableDictionary _handlersForKey = new NSMutableDictionary() [static, private] |
final NSMutableDictionary _instances = new NSMutableDictionary() [static, private] |
final Logger log = Logger.getLogger(ERXAssert.class) [static, private] |
1.5.8