java.lang.Objectjava.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
java.lang.IllegalArgumentException
org.apache.commons.lang.NullArgumentException
All Implemented Interfaces:
Serializable
Thrown to indicate that an argument was null and should
not have been.
This exception supplements the standard IllegalArgumentException
by providing a more semantically rich description of the problem.
NullArgumentException represents the case where a method takes
in a parameter that must not be null.
Some coding standards would use NullPointerException for this case,
others will use IllegalArgumentException.
Thus this exception would be used in place of
IllegalArgumentException, yet it still extends it.
public void foo(String str) {
if (str == null) {
throw new NullArgumentException("str");
}
// do something with the string
}
Matthew - HawthorneStephen - Colebourne2.0 - $ - Id: NullArgumentException.java 437554 2006-08-28 06:21:41Z bayard $| Constructor: |
|---|
Instantiates with the given argument name.
|
| Methods from java.lang.Throwable: |
|---|
| fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
| Methods from java.lang.Object: |
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |