public class IncompleteArgumentException
extends java.lang.IllegalArgumentException
Thrown to indicate an incomplete argument to a method.
This exception supplements the standard IllegalArgumentException
by providing a more semantically rich description of the problem.
IncompleteArgumentException
represents the case where a method takes
in a parameter that has a number of properties, some of which have not been set.
A case might be a search requirements bean that must have three properties set
in order for the method to run, but only one is actually set.
This exception would be used in place of
IllegalArgumentException
, yet it still extends it.
public void foo(PersonSearcher search) { if (search.getSurname() == null || search.getForename() == null || search.getSex() == null) { throw new IncompleteArgumentException("search"); } // do something with the searcher }
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID
Required for serialization support.
|
Constructor and Description |
---|
IncompleteArgumentException(java.lang.String argName)
Instantiates with the specified description.
|
IncompleteArgumentException(java.lang.String argName,
java.lang.String[] items)
Instantiates with the specified description.
|
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
safeArrayToString(java.lang.Object[] array)
Converts an array to a string without throwing an exception.
|
private static final long serialVersionUID
Serializable
,
Constant Field Valuespublic IncompleteArgumentException(java.lang.String argName)
Instantiates with the specified description.
argName
- a description of the incomplete argumentpublic IncompleteArgumentException(java.lang.String argName, java.lang.String[] items)
Instantiates with the specified description.
argName
- a description of the incomplete argumentitems
- an array describing the arguments missing