public class NullArgumentException
extends java.lang.IllegalArgumentException
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 and Description |
---|
NullArgumentException(java.lang.String msg)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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. |
public NullArgumentException(java.lang.String msg)
msg
- The message to use in the exception describing the problem.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.Copyright © 2014 Red Hat. All Rights Reserved.