public class ExceptionToolkit
extends java.lang.Object
ExceptionToolkit provides a set of convenience methods and utilities for throwing,
handling, and using Exceptions.| Constructor and Description |
|---|
ExceptionToolkit() |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertArgumentNotNull(java.lang.Object parameterValue,
java.lang.String parameterName)
Asserts that the given parameter value is not
null. |
static java.lang.String |
formatMessageString(java.lang.String message,
java.lang.Object... args)
Formats the given message
String with given two arguments and by using the
MessageFormat class. |
static void |
throwIllegalArgumentException(java.lang.String message)
Creates and throws an
IllegalArgumentException with the given message. |
static void |
throwIllegalArgumentException(java.lang.String message,
java.lang.Object... args)
Creates and throws an
IllegalArgumentException with the given message and message
formatting arguments. |
static void |
throwIllegalStateException(java.lang.String message)
Creates and throws an
IllegalStateException with the given message. |
static void |
throwNullParameterException(java.lang.String parameterName)
Creates and throws an
IllegalArgumentException with the given message and message
formatting arguments. |
public static void assertArgumentNotNull(java.lang.Object parameterValue,
java.lang.String parameterName)
null. If null, throws an
IllegalArgumentException.parameterValue - The parameter value to be tested.parameterName - The name of the parameter.public static java.lang.String formatMessageString(java.lang.String message,
java.lang.Object... args)
String with given two arguments and by using the
MessageFormat class.message - The message to be displayed as String.args - The optional arguments for MessageFormat class.String containing the formatted message.public static void throwIllegalArgumentException(java.lang.String message)
IllegalArgumentException with the given message.message - The message to be displayed as String.public static void throwIllegalStateException(java.lang.String message)
IllegalStateException with the given message.message - The message to be displayed as String.public static void throwIllegalArgumentException(java.lang.String message,
java.lang.Object... args)
IllegalArgumentException with the given message and message
formatting arguments.message - The message to be displayed as String.args - The optional message formatting arguments.public static void throwNullParameterException(java.lang.String parameterName)
IllegalArgumentException with the given message and message
formatting arguments.parameterName - The name of the parameter as String.