Package org.apache.commons.lang
Class IncompleteArgumentException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
java.lang.IllegalArgumentException
org.apache.commons.lang.IncompleteArgumentException
- All Implemented Interfaces:
Serializable
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
}
- Since:
- 2.0
- Version:
- $Id: IncompleteArgumentException.java 437554 2006-08-28 06:21:41Z bayard $
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longRequired for serialization support. -
Constructor Summary
ConstructorsConstructorDescriptionIncompleteArgumentException(String argName) Instantiates with the specified description.IncompleteArgumentException(String argName, String[] items) Instantiates with the specified description. -
Method Summary
Modifier and TypeMethodDescriptionprivate static final StringsafeArrayToString(Object[] array) Converts an array to a string without throwing an exception.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDRequired for serialization support.- See Also:
-
-
Constructor Details
-
IncompleteArgumentException
Instantiates with the specified description.
- Parameters:
argName- a description of the incomplete argument
-
IncompleteArgumentException
Instantiates with the specified description.
- Parameters:
argName- a description of the incomplete argumentitems- an array describing the arguments missing
-
-
Method Details
-
safeArrayToString
Converts an array to a string without throwing an exception.
- Parameters:
array- an array- Returns:
- the array as a string
-