|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.util.Assert
Used for assertion checking. Every method prints a message to System.out if the assertion fails along with a stack trace to help pinpoint the class and line number in the source code where the assertion failed.
In general, things that are asserted using this class should be programming
errors, because clients are not expected to know how to check for and
handle failed assertions.
Supported API: false
Extendable: false
Field Summary | |
private static String |
CLASSNAME
|
private static String |
COMPATIBLE_TYPE
|
private static String |
NON_EMPTY_ARRAY
|
private static String |
NON_NULL
|
private static String |
RESOURCE
|
Constructor Summary | |
Assert()
|
Method Summary | |
static boolean |
ASSERT(boolean condition,
String message)
Tests if a boolean condition is satisfied. |
static boolean |
ASSERT(boolean condition,
String pattern,
Object[] inserts)
Tests if a boolean condition is satisfied. |
private static String |
getMessage(String msg,
Object[] inserts)
Formats a message with the given object inserts using java.text.MessageFormat.format. |
private static String |
getStackTrace()
generates a stack trace that shows the call stack with methods and line numbers. |
static void |
main(String[] args)
Used to test this class |
static boolean |
NON_EMPTY_ARRAY(Object[] array)
Tests if an array is empty. |
static boolean |
NON_NULL(Object obj)
Tests if an object is null. |
static boolean |
TYPE_COMPATIBLE(Class a_class,
Class type)
Tests if two classes are type compatible with each other. |
static boolean |
TYPE_COMPATIBLE(Object obj,
Class type)
Tests if an object's type is compatible with another type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final String RESOURCE
private static final String CLASSNAME
private static final String NON_NULL
private static final String NON_EMPTY_ARRAY
private static final String COMPATIBLE_TYPE
Constructor Detail |
public Assert()
Method Detail |
public static boolean ASSERT(boolean condition, String message)
condition
- message
-
public static boolean ASSERT(boolean condition, String pattern, Object[] inserts)
condition
- pattern
- Message with placeholders for object inserts (e.g. {0}) @see java.text.MessageFormatinserts
- objects that will be inserted into the message using java.text.MesageFormat.format @see java.text.MessageFormat
private static String getStackTrace()
private static String getMessage(String msg, Object[] inserts)
msg
- inserts
-
public static boolean NON_NULL(Object obj)
obj
- The object to test for null.
public static boolean NON_EMPTY_ARRAY(Object[] array)
array
-
public static boolean TYPE_COMPATIBLE(Object obj, Class type)
obj
- type
- The type that the object is being checked against for compatability.
public static boolean TYPE_COMPATIBLE(Class a_class, Class type)
a_class
- type
- The type that the object is being checked against for compatability.
public static void main(String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |