|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
java.lang.IllegalArgumentException
org.ops4j.lang.NullArgumentException
public class NullArgumentException
Exception thrown when the argument to a method or constructor is null and not handled by the method/constructor/class.
The argument in the only constructor of this exception should only take the name of the declared argument that is null, for instance;
public Person( String name, int age )
{
NullArgumentException.validateNotEmpty( name, "name" )
if( age > 120 )
throw new IllegalArgumentException( "age > 120" );
if( age < 0 )
throw new IllegalArgumentException( "age < 0" );
}
| Constructor Summary | |
|---|---|
NullArgumentException(java.lang.String msg)
Constructor. |
|
| Method Summary | |
|---|---|
static void |
validateNotEmpty(java.lang.Object[] arrayToCheck,
java.lang.String argumentName)
Validates that the array instance is not null and that it has entries. |
static void |
validateNotEmpty(java.util.Properties propertiesToCheck,
java.lang.String argumentName)
Validates that the Properties instance is not null and that it has entries. |
static void |
validateNotEmpty(java.lang.String stringToCheck,
boolean trim,
java.lang.String argumentName)
Validates that the string is not null and not an empty string. |
static void |
validateNotEmpty(java.lang.String stringToCheck,
java.lang.String argumentName)
Validates that the string is not null and not an empty string without trimming the string. |
static void |
validateNotEmptyContent(java.lang.String[] arrayToCheck,
boolean trim,
java.lang.String argumentName)
Validates that the string array instance is not null and that it has entries that are not null or empty. |
static void |
validateNotEmptyContent(java.lang.String[] arrayToCheck,
java.lang.String argumentName)
Validates that the string array instance is not null and that it has entries that are not null or empty eithout trimming the string. |
static void |
validateNotNull(java.lang.Object obj,
java.lang.String objectName)
Validates that the object obj is not null. |
| Methods inherited from class java.lang.Throwable |
|---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public NullArgumentException(java.lang.String msg)
msg - The message to use in the exception describing the problem.| Method Detail |
|---|
public static void validateNotNull(java.lang.Object obj,
java.lang.String objectName)
throws NullArgumentException
obj is not null.
obj - The object to be tested.objectName - The name of the object, which is used to construct the exception message.
NullArgumentException - if the stringToCheck is either null or zero characters long.
public static void validateNotEmpty(java.lang.String stringToCheck,
java.lang.String argumentName)
throws NullArgumentException
stringToCheck - The object to be tested.argumentName - The name of the object, which is used to construct the exception message.
NullArgumentException - if the stringToCheck is either null or zero characters long.
public static void validateNotEmpty(java.lang.String stringToCheck,
boolean trim,
java.lang.String argumentName)
throws NullArgumentException
stringToCheck - The object to be tested.trim - If the elements should be trimmed before checking if emptyargumentName - The name of the object, which is used to construct the exception message.
NullArgumentException - if the stringToCheck is either null or zero characters long.
public static void validateNotEmpty(java.util.Properties propertiesToCheck,
java.lang.String argumentName)
throws NullArgumentException
propertiesToCheck - The object to be tested.argumentName - The name of the object, which is used to construct the exception message.
NullArgumentException - if the Properties instance is null or does not have any entries.
public static void validateNotEmpty(java.lang.Object[] arrayToCheck,
java.lang.String argumentName)
throws NullArgumentException
arrayToCheck - The object to be tested.argumentName - The name of the object, which is used to construct the exception message.
NullArgumentException - if the array instance is null or does not have any entries.
public static void validateNotEmptyContent(java.lang.String[] arrayToCheck,
java.lang.String argumentName)
throws NullArgumentException
arrayToCheck - The object to be tested.argumentName - The name of the object, which is used to construct the exception message.
NullArgumentException - if the array instance is null or does not have any entries.
public static void validateNotEmptyContent(java.lang.String[] arrayToCheck,
boolean trim,
java.lang.String argumentName)
throws NullArgumentException
arrayToCheck - The object to be tested.trim - If the elements should be trimmed before checking if emptyargumentName - The name of the object, which is used to construct the exception message.
NullArgumentException - if the array instance is null or does not have any entries.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||