rj.tools.util
Class Checker

java.lang.Object
  extended byrj.tools.util.Checker

public class Checker
extends java.lang.Object

Checker for certain object values; mainly intended for argument checking in methods, but it can also be used to check for pre- and post - conditions. if a check fails, the appropriate RuntimeException is thrown.

Version:
__0.98.1__
Author:
Ralph Jocham

Constructor Summary
Checker()
           
 
Method Summary
static boolean assertFalse(boolean result)
          assertFalse - check if the boolean expression returns a true value
static boolean assertFalse(boolean result, java.lang.String text)
          assertFalse - check if the boolean expression returns a true value
static boolean assertTrue(boolean result)
          assertTrue - check if the boolean expression returns a true value
static boolean assertTrue(boolean result, java.lang.String text)
          assertTrue - check if the boolean expression returns a true value
static boolean isArgValid(boolean result)
          argValid - check if the boolean expression returns a true value
static boolean isArgValid(boolean result, java.lang.String text)
          argValid - check if the boolean expression returns a true value
static boolean isNotNull(java.lang.Object obj)
          notNull - check if an object has no null reference
static boolean isNotNull(java.lang.Object obj, java.lang.String text)
          notNull - check if an object has no null reference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Checker

public Checker()
Method Detail

isNotNull

public static boolean isNotNull(java.lang.Object obj)
notNull - check if an object has no null reference

Parameters:
obj - an Object
Returns:
a boolean value - if not Null; otherwise a NullPointerException is thrown

isNotNull

public static boolean isNotNull(java.lang.Object obj,
                                java.lang.String text)
notNull - check if an object has no null reference

Parameters:
obj - an Object
text - Represents the text message to be thrown if the Object is null
Returns:
a boolean value - if not Null; otherwise a NullPointerException is thrown, having text as message

isArgValid

public static boolean isArgValid(boolean result)
argValid - check if the boolean expression returns a true value

Parameters:
result - Represents the boolean value
Returns:
a boolean value - if true; IllegalArgumentException is thrown instead

isArgValid

public static boolean isArgValid(boolean result,
                                 java.lang.String text)
argValid - check if the boolean expression returns a true value

Parameters:
result - Represents the boolean value
text - Represents the text message to be thrown if the value is false
Returns:
a boolean value - if true; IllegalArgumentException is thrown instead, having text as message

assertTrue

public static boolean assertTrue(boolean result)
assertTrue - check if the boolean expression returns a true value

Parameters:
result - Represents the boolean value
Returns:
a boolean value - if true; RuntimeException is thrown instead

assertTrue

public static boolean assertTrue(boolean result,
                                 java.lang.String text)
assertTrue - check if the boolean expression returns a true value

Parameters:
result - an Object
text - Represents the text message to be thrown if the value is false
Returns:
a boolean value - if true; RuntimeException is thrown instead, having text as message

assertFalse

public static boolean assertFalse(boolean result)
assertFalse - check if the boolean expression returns a true value

Parameters:
result - Represents the boolean value
Returns:
a boolean value - if true; RuntimeException is thrown instead

assertFalse

public static boolean assertFalse(boolean result,
                                  java.lang.String text)
assertFalse - check if the boolean expression returns a true value

Parameters:
result - an Object
text - Represents the text message to be thrown if the value is false
Returns:
a boolean value - if true; RuntimeException is thrown instead, having text as message


(c) 1999-2005 by Ralph Jocham (rjocham72@netscape.net)
JCSC is released under the terms of the GNU General Public License