com.sdm.quasar.client.core.common.util
Class ArgumentChecker

java.lang.Object
  extended bycom.sdm.quasar.client.core.common.util.ArgumentChecker

public abstract class ArgumentChecker
extends java.lang.Object

A simple helper class, that helps checking arguments by throwing IllegalArgumentExceptions, if the condition checked was not fulfilled.

Version:
1.$Revision$
Author:
Thomas Wolf

Method Summary
static void checkInstanceOf(java.lang.Class argClass, java.lang.String argName, java.lang.Class superClass)
          Checks, if the given argument class is subclass of the given super class.
static void checkInstanceOf(java.lang.Object arg, java.lang.String argName, java.lang.Class superClass)
          Checks, if the given argument is an instance of the given super class.
static void checkNotNull(java.lang.Object arg, java.lang.String argName)
          Checks, if the given argument is not null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkNotNull

public static void checkNotNull(java.lang.Object arg,
                                java.lang.String argName)
                         throws java.lang.IllegalArgumentException
Checks, if the given argument is not null. Throws an IllegalArgumentException, if is not.

Parameters:
arg - the argument to check
argName - the argument name (should not be null)
Throws:
java.lang.IllegalArgumentException - if the argument is null

checkInstanceOf

public static void checkInstanceOf(java.lang.Object arg,
                                   java.lang.String argName,
                                   java.lang.Class superClass)
                            throws java.lang.IllegalArgumentException
Checks, if the given argument is an instance of the given super class.

Parameters:
arg - the argument to check
argName - the argument name (should not be null)
superClass - the superclass to check against (not null)
Throws:
java.lang.IllegalArgumentException - if the arg is not instance of the given superclass or if the superclass given is null

checkInstanceOf

public static void checkInstanceOf(java.lang.Class argClass,
                                   java.lang.String argName,
                                   java.lang.Class superClass)
                            throws java.lang.IllegalArgumentException
Checks, if the given argument class is subclass of the given super class.

Parameters:
argClass - the argument class to check
argName - the argument name (should not be null)
superClass - the superclass to check against (not null)
Throws:
java.lang.IllegalArgumentException - if the arg is not instance of the given superclass or if the superclass given is null