Package com.martiansoftware.jsap
Interface ExceptionMap
- All Known Implementing Classes:
JSAPResult
public interface ExceptionMap
A class for aggregating exceptions thrown by JSAP's parsing process. This
class is necessary as it is desirable to have information regarding ALL of
the reasons for a failed parse rather than just the FIRST reason.
- Author:
- Marty Lamb
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addException
(String id, Exception exception) Adds the specified exception to the exception map.getException
(String id) Returns the first exception associated with the specified parameter ID.Returns an array of ALL exceptions associated with the specified parameter ID.
-
Method Details
-
addException
Adds the specified exception to the exception map. Exceptions are keyed by the ID of the parameters with which they are associated. "General" exceptions not associated with a particular parameter have a null key.- Parameters:
id
- the unique ID of the parameter with which the specified values are associated.exception
- the exception to associate with the specified key.
-
getException
Returns the first exception associated with the specified parameter ID. "General" exceptions can be retrieved with a null id. If no exceptions are associated with the specified parameter ID, null is returned.- Parameters:
id
- the unique ID of the parameter for which the first exception is requested- Returns:
- the first exception associated with the specified ID, or null if no exceptions are associated with the specified ID.
-
getExceptionArray
Returns an array of ALL exceptions associated with the specified parameter ID. If no exceptions are associated with the specified parameter ID, an empty (zero-length) array is returned.- Parameters:
id
- the unique ID of the parameter for which the exceptions are requested.- Returns:
- an array of ALL exceptions associated with the specified parameter ID, or an empty (zero-length) array if no exceptions are associated with the specified parameter ID.
-