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
 void addException(String id, Exception exception)
          Adds the specified exception to the exception map.
 Exception getException(String id)
          Returns the first exception associated with the specified parameter ID.
 Exception[] getExceptionArray(String id)
          Returns an array of ALL exceptions associated with the specified parameter ID.
 

Method Detail

addException

public void addException(String id,
                         Exception exception)
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

public Exception getException(String id)
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

public Exception[] getExceptionArray(String id)
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.


Copyright © 2002-2006, Martian Software, Inc.. All Rights Reserved.
For the latest version and documentation, please visit http://www.martiansoftware.com/jsap