com.martiansoftware.jsap
Class JSAPResult

java.lang.Object
  extended bycom.martiansoftware.jsap.JSAPResult
All Implemented Interfaces:
ExceptionMap

public class JSAPResult
extends Object
implements ExceptionMap

Encapsulates the results of JSAP's parse() methods. The most basic means of obtaining a parse result from a JSAPResult is the getObject(String) method, but a number of getXXX() methods are provided to make your code more readable and to avoid re-casting.

Author:
Marty Lamb

Method Summary
 void addException(String id, Exception exception)
          Adds the specified exception to the exception map.
 boolean contains(String id)
          Returns true if this JSAPResult contains any results for the specified id.
 Iterator getBadParameterIDIterator()
          Returns an Iterator over the IDs of all parameters with associated exceptions (which can in turn be obtained via getExceptionIterator(String)).
 BigDecimal getBigDecimal(String id)
          Returns the first BigDecimal value associated with the specified id.
 BigDecimal getBigDecimal(String id, BigDecimal defaultValue)
          Returns the first BigDecimal value associated with the specified id.
 BigDecimal[] getBigDecimalArray(String id)
          Returns an array of BigDecimal values associated with the specified id.
 BigInteger getBigInteger(String id)
          Returns the first BigInteger value associated with the specified id.
 BigInteger getBigInteger(String id, BigInteger defaultValue)
          Returns the first BigInteger value associated with the specified id.
 BigInteger[] getBigIntegerArray(String id)
          Returns an array of BigInteger values associated with the specified id.
 boolean getBoolean(String id)
          Returns the first boolean value associated with the specified id.
 boolean getBoolean(String id, boolean defaultValue)
          Returns the first boolean value associated with the specified id.
 boolean[] getBooleanArray(String id)
          Returns an array of boolean values associated with the specified id.
 byte getByte(String id)
          Returns the first byte value associated with the specified id.
 byte getByte(String id, byte defaultValue)
          Returns the first byte value associated with the specified id.
 byte[] getByteArray(String id)
          Returns an array of byte values associated with the specified id.
 char getChar(String id)
          Returns the first char value associated with the specified id.
 char getChar(String id, char defaultValue)
          Returns the first char value associated with the specified id.
 char[] getCharArray(String id)
          Returns an array of char values associated with the specified id.
 Class getClass(String id)
          Returns the first Class value associated with the specified id.
 Class getClass(String id, Class defaultValue)
          Returns the first Class value associated with the specified id.
 Class[] getClassArray(String id)
          Returns an array of Class values associated with the specified id.
 Color getColor(String id)
          Returns the first Color value associated with the specified id.
 Color getColor(String id, Color defaultValue)
          Returns the first Color value associated with the specified id.
 Color[] getColorArray(String id)
          Returns an array of Color values associated with the specified id.
 Date getDate(String id)
          Returns the first Date value associated with the specified id.
 Date getDate(String id, Date defaultValue)
          Returns the first Date value associated with the specified id.
 Date[] getDateArray(String id)
          Returns an array of Date values associated with the specified id.
 double getDouble(String id)
          Returns the first double value associated with the specified id.
 double getDouble(String id, double defaultValue)
          Returns the first double value associated with the specified id.
 double[] getDoubleArray(String id)
          Returns an array of double values associated with the specified id.
 Iterator getErrorMessageIterator()
          Returns an iterator over all error messages generated during parsing.
 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.
 Iterator getExceptionIterator(String id)
          Returns an Iterator ovar ALL exceptions associated with the specified parameter ID.
 File getFile(String id)
          Returns the first File value associated with the specified id.
 File getFile(String id, File defaultValue)
          Returns the first File value associated with the specified id.
 File[] getFileArray(String id)
          Returns an array of File values associated with the specified id.
 float getFloat(String id)
          Returns the first float value associated with the specified id.
 float getFloat(String id, float defaultValue)
          Returns the first float value associated with the specified id.
 float[] getFloatArray(String id)
          Returns an array of float values associated with the specified id.
 InetAddress getInetAddress(String id)
          Returns the first InetAddress value associated with the specified id.
 InetAddress getInetAddress(String id, InetAddress defaultValue)
          Returns the first InetAddress value associated with the specified id.
 InetAddress[] getInetAddressArray(String id)
          Returns an array of InetAddress values associated with the specified id.
 int getInt(String id)
          Returns the first integer value associated with the specified id.
 int getInt(String id, int defaultValue)
          Returns the first integer value associated with the specified id.
 int[] getIntArray(String id)
          Returns an array of integer values associated with the specified id.
 long getLong(String id)
          Returns the first long value associated with the specified id.
 long getLong(String id, long defaultValue)
          Returns the first long value associated with the specified id.
 long[] getLongArray(String id)
          Returns an array of long values associated with the specified id.
 Object getObject(String id)
          Returns the first object associated with the specified ID.
 Object[] getObjectArray(String id)
          Returns all values associated with the specified ID.
 Object[] getObjectArray(String id, Object[] a)
          Returns an array containing all of the values associated with the specified ID.
 Package getPackage(String id)
          Returns the first Package value associated with the specified id.
 Package getPackage(String id, Package defaultValue)
          Returns the first Package value associated with the specified id.
 Package[] getPackageArray(String id)
          Returns an array of Package values associated with the specified id.
 String getQualifiedSwitchValue(String id)
          Returns the string value associated with the specified ID for QualifiedSwitches.
 short getShort(String id)
          Returns the first short value associated with the specified id.
 short getShort(String id, short defaultValue)
          Returns the first short value associated with the specified id.
 short[] getShortArray(String id)
          Returns an array of short values associated with the specified id.
 String getString(String id)
          Returns the first String value associated with the specified id.
 String getString(String id, String defaultValue)
          Returns the first String value associated with the specified id.
 String[] getStringArray(String id)
          Returns an array of String values associated with the specified id.
 URL getURL(String id)
          Returns the first URL value associated with the specified id.
 URL getURL(String id, URL defaultValue)
          Returns the first URL value associated with the specified id.
 URL[] getURLArray(String id)
          Returns an array of URL values associated with the specified id.
 boolean success()
          Returns a boolean indicating whether the parse that produced this JSAPResult was successful.
 boolean userSpecified(String id)
          Returns true if this JSAPResult contains any user-specified values for the specified id.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

contains

public boolean contains(String id)
Returns true if this JSAPResult contains any results for the specified id. Note that these results may be default values, and thus contains(id) might return true even when the user has not herself supplied the parameter.

This is just a means to see if there are values to retrieve.

Parameters:
id - the ID to check
Returns:
true if there are any values in this JSAPResult associated with the specified ID.

userSpecified

public boolean userSpecified(String id)
Returns true if this JSAPResult contains any user-specified values for the specified id. If this JSAPResult contains default values (or no values) for the specified id, this method returns false.

Parameters:
id - the ID to check
Returns:
indication of whether the user specified a value for the specified id.

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.

Specified by:
addException in interface ExceptionMap
Parameters:
id - the unique ID of the parameter with which the specified values are associated.
exception - the exception to associate with the specified key.
See Also:
ExceptionMap.addException(String,Exception)

getObject

public Object getObject(String id)
Returns the first object associated with the specified ID. If more than one object is expected, call getObjectArray() instead.

Parameters:
id - the unique ID of the parameter for which the first value is requested
Returns:
the first object associated with the specified ID. If more than one object is expected, call getObjectArray() instead.

getObjectArray

public Object[] getObjectArray(String id)
Returns all values associated with the specified ID. If no values are currently associated with the specified ID, an empty (zero-length) array is returned.

Parameters:
id - the unique ID of the parameter for which the values are requested
Returns:
all values associated with the specified ID. If no values are currently associated with the specified ID, an empty (zero-length) array is returned.

getObjectArray

public Object[] getObjectArray(String id,
                               Object[] a)
Returns an array containing all of the values associated with the specified ID. The runtime type of the returned array is that of the specified array. If the list fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this list..

Parameters:
id - the unique ID of the parameter for which the values are requested
a - the array into which the elements of the list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
Returns:
an array containing all of the values associated with the specified ID. The runtime type of the returned array is that of the specified array. If the list fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this list..

getBoolean

public boolean getBoolean(String id)
Returns the first boolean value associated with the specified id.

Parameters:
id - the id of the boolean value to retrieve
Returns:
the boolean value associated with the specified id.
See Also:
getBoolean(String, boolean), getBooleanArray(String)

getBoolean

public boolean getBoolean(String id,
                          boolean defaultValue)
Returns the first boolean value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Boolean, the specified default value is returned.

Parameters:
id - the id of the boolean value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Boolean.
Returns:
the first boolean value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Boolean, the specified default value is returned.
See Also:
getBoolean(String), getBooleanArray(String)

getBooleanArray

public boolean[] getBooleanArray(String id)
Returns an array of boolean values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the boolean value(s) to return.
Returns:
an array containing the boolean value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getBoolean(String), getBoolean(String,boolean)

getInt

public int getInt(String id)
Returns the first integer value associated with the specified id.

Parameters:
id - the id of the integer value to retrieve
Returns:
the integer value associated with the specified id.
See Also:
getInt(String,int), getIntArray(String)

getInt

public int getInt(String id,
                  int defaultValue)
Returns the first integer value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Integer, the specified default value is returned.

Parameters:
id - the id of the boolean value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Integer.
Returns:
the first integer value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Integer, the specified default value is returned.
See Also:
getInt(String), getIntArray(String)

getQualifiedSwitchValue

public String getQualifiedSwitchValue(String id)
Returns the string value associated with the specified ID for QualifiedSwitches.

Parameters:
id - the unique ID of the parameter for which the value is requested
Returns:
the value for the QualifiedSwitch associated with the specified ID or null is no such value is present or the ID does not belong to a QualifiedSwitch

getIntArray

public int[] getIntArray(String id)
Returns an array of integer values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the integer value(s) to return.
Returns:
an array containing the integer value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getInt(String), getInt(String,int)

getLong

public long getLong(String id)
Returns the first long value associated with the specified id.

Parameters:
id - the id of the long value to retrieve
Returns:
the long value associated with the specified id.
See Also:
getLong(String,long), getLongArray(String)

getLong

public long getLong(String id,
                    long defaultValue)
Returns the first long value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Long, the specified default value is returned.

Parameters:
id - the id of the long value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Long.
Returns:
the first long value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Long, the specified default value is returned.
See Also:
getLong(String), getLongArray(String)

getLongArray

public long[] getLongArray(String id)
Returns an array of long values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the long value(s) to return.
Returns:
an array containing the long value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getLong(String), getLong(String,long)

getByte

public byte getByte(String id)
Returns the first byte value associated with the specified id.

Parameters:
id - the id of the byte value to retrieve
Returns:
the byte value associated with the specified id.
See Also:
getByte(String,byte), getByteArray(String)

getByte

public byte getByte(String id,
                    byte defaultValue)
Returns the first byte value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Byte, the specified default value is returned.

Parameters:
id - the id of the byte value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Byte.
Returns:
the first byte value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Byte, the specified default value is returned.
See Also:
getByte(String), getByteArray(String)

getByteArray

public byte[] getByteArray(String id)
Returns an array of byte values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the byte value(s) to return.
Returns:
an array containing the byte value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getByte(String), getByte(String,byte)

getChar

public char getChar(String id)
Returns the first char value associated with the specified id.

Parameters:
id - the id of the char value to retrieve
Returns:
the char value associated with the specified id.
See Also:
getChar(String,char), getCharArray(String)

getChar

public char getChar(String id,
                    char defaultValue)
Returns the first char value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Character, the specified default value is returned.

Parameters:
id - the id of the char value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Character.
Returns:
the first char value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Character, the specified default value is returned.
See Also:
getChar(String), getCharArray(String)

getCharArray

public char[] getCharArray(String id)
Returns an array of char values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the char value(s) to return.
Returns:
an array containing the char value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getChar(String), getChar(String,char)

getShort

public short getShort(String id)
Returns the first short value associated with the specified id.

Parameters:
id - the id of the short value to retrieve
Returns:
the short value associated with the specified id.
See Also:
getShort(String,short), getShortArray(String)

getShort

public short getShort(String id,
                      short defaultValue)
Returns the first short value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Short, the specified default value is returned.

Parameters:
id - the id of the short value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Short.
Returns:
the first short value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Short, the specified default value is returned.
See Also:
getShort(String), getShortArray(String)

getShortArray

public short[] getShortArray(String id)
Returns an array of short values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the short value(s) to return.
Returns:
an array containing the short value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getShort(String), getShort(String,short)

getDouble

public double getDouble(String id)
Returns the first double value associated with the specified id.

Parameters:
id - the id of the double value to retrieve
Returns:
the double value associated with the specified id.
See Also:
getDouble(String,double), getDoubleArray(String)

getDouble

public double getDouble(String id,
                        double defaultValue)
Returns the first double value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Double, the specified default value is returned.

Parameters:
id - the id of the double value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Double.
Returns:
the first double value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Double, the specified default value is returned.
See Also:
getDouble(String), getDoubleArray(String)

getDoubleArray

public double[] getDoubleArray(String id)
Returns an array of double values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the double value(s) to return.
Returns:
an array containing the double value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getDouble(String), getDouble(String,double)

getFloat

public float getFloat(String id)
Returns the first float value associated with the specified id.

Parameters:
id - the id of the float value to retrieve
Returns:
the float value associated with the specified id.
See Also:
getFloat(String,float), getFloatArray(String)

getFloat

public float getFloat(String id,
                      float defaultValue)
Returns the first float value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Float, the specified default value is returned.

Parameters:
id - the id of the float value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Float.
Returns:
the first float value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Float, the specified default value is returned.
See Also:
getFloat(String), getFloatArray(String)

getFloatArray

public float[] getFloatArray(String id)
Returns an array of float values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the float value(s) to return.
Returns:
an array containing the float value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getFloat(String), getFloat(String,float)

getString

public String getString(String id)
Returns the first String value associated with the specified id.

Parameters:
id - the id of the String value to retrieve
Returns:
the String value associated with the specified id.
See Also:
getString(String,String), getStringArray(String)

getString

public String getString(String id,
                        String defaultValue)
Returns the first String value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.String, the specified default value is returned.

Parameters:
id - the id of the String value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.String.
Returns:
the first String value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.String, the specified default value is returned.
See Also:
getString(String), getStringArray(String)

getStringArray

public String[] getStringArray(String id)
Returns an array of String values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the String value(s) to return.
Returns:
an array containing the String value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getString(String), getString(String,String)

getBigDecimal

public BigDecimal getBigDecimal(String id)
Returns the first BigDecimal value associated with the specified id.

Parameters:
id - the id of the BigDecimal value to retrieve
Returns:
the BigDecimal value associated with the specified id.
See Also:
getBigDecimal(String, BigDecimal), getBigDecimalArray(String), BigDecimal

getBigDecimal

public BigDecimal getBigDecimal(String id,
                                BigDecimal defaultValue)
Returns the first BigDecimal value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.math.BigDecimal, the specified default value is returned.

Parameters:
id - the id of the BigDecimal value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.math.BigDecimal.
Returns:
the first BigDecimal value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.BigDecimal, the specified default value is returned.
See Also:
getBigDecimal(String), getBigDecimalArray(String), BigDecimal

getBigDecimalArray

public BigDecimal[] getBigDecimalArray(String id)
Returns an array of BigDecimal values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the BigDecimal value(s) to return.
Returns:
an array containing the BigDecimal value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getBigDecimal(String), getBigDecimal(String,BigDecimal), BigDecimal

getBigInteger

public BigInteger getBigInteger(String id)
Returns the first BigInteger value associated with the specified id.

Parameters:
id - the id of the BigInteger value to retrieve
Returns:
the BigInteger value associated with the specified id.
See Also:
getBigInteger(String, BigInteger), getBigIntegerArray(String), BigInteger

getBigInteger

public BigInteger getBigInteger(String id,
                                BigInteger defaultValue)
Returns the first BigInteger value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.math.BigInteger, the specified default value is returned.

Parameters:
id - the id of the BigInteger value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.math.BigInteger.
Returns:
the first boolean value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.BigInteger, the specified default value is returned.
See Also:
getBigInteger(String), getBigIntegerArray(String), BigInteger

getBigIntegerArray

public BigInteger[] getBigIntegerArray(String id)
Returns an array of BigInteger values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the BigInteger value(s) to return.
Returns:
an array containing the BigInteger value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getBigInteger(String), getBigInteger(String,BigInteger), BigInteger

getClass

public Class getClass(String id)
Returns the first Class value associated with the specified id.

Parameters:
id - the id of the Class value to retrieve
Returns:
the Class value associated with the specified id.
See Also:
getClass(String, Class), getClassArray(String), Class

getClass

public Class getClass(String id,
                      Class defaultValue)
Returns the first Class value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Class, the specified default value is returned.

Parameters:
id - the id of the Class value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Class.
Returns:
the first Class value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Class, the specified default value is returned.
See Also:
getClass(String), getClassArray(String), Class

getClassArray

public Class[] getClassArray(String id)
Returns an array of Class values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the Class value(s) to return.
Returns:
an array containing the Class value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getClass(String), getClass(String,Class), Class

getInetAddress

public InetAddress getInetAddress(String id)
Returns the first InetAddress value associated with the specified id.

Parameters:
id - the id of the InetAddress value to retrieve
Returns:
the InetAddress value associated with the specified id.
See Also:
getInetAddress(String, InetAddress), getInetAddressArray(String), InetAddress

getInetAddress

public InetAddress getInetAddress(String id,
                                  InetAddress defaultValue)
Returns the first InetAddress value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.net.InetAddress, the specified default value is returned.

Parameters:
id - the id of the InetAddress value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.net.InetAddress.
Returns:
the first InetAddress value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.InetAddress, the specified default value is returned.
See Also:
getInetAddress(String), getInetAddressArray(String), InetAddress

getInetAddressArray

public InetAddress[] getInetAddressArray(String id)
Returns an array of InetAddress values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the InetAddress value(s) to return.
Returns:
an array containing the InetAddress value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getInetAddress(String), getInetAddress(String,InetAddress), InetAddress

getPackage

public Package getPackage(String id)
Returns the first Package value associated with the specified id.

Parameters:
id - the id of the Package value to retrieve
Returns:
the Package value associated with the specified id.
See Also:
getPackage(String, Package), getPackageArray(String), Package

getPackage

public Package getPackage(String id,
                          Package defaultValue)
Returns the first Package value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Package, the specified default value is returned.

Parameters:
id - the id of the Package value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Package.
Returns:
the first Package value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Package, the specified default value is returned.
See Also:
getPackage(String), getPackageArray(String), Package

getPackageArray

public Package[] getPackageArray(String id)
Returns an array of Package values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the Package value(s) to return.
Returns:
an array containing the Package value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getPackage(String), getPackage(String,Package), Package

getURL

public URL getURL(String id)
Returns the first URL value associated with the specified id.

Parameters:
id - the id of the URL value to retrieve
Returns:
the URL value associated with the specified id.
See Also:
getURL(String,URL), getURLArray(String), URL

getURL

public URL getURL(String id,
                  URL defaultValue)
Returns the first URL value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.net.URL, the specified default value is returned.

Parameters:
id - the id of the URL value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.net.URL.
Returns:
the first URL value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.net.URL, the specified default value is returned.
See Also:
getURL(String), getURLArray(String), URL

getURLArray

public URL[] getURLArray(String id)
Returns an array of URL values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the URL value(s) to return.
Returns:
an array containing the URL value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getURL(String), getURL(String,URL), URL

getColor

public Color getColor(String id)
Returns the first Color value associated with the specified id.

Parameters:
id - the id of the Color value to retrieve
Returns:
the Color value associated with the specified id.
See Also:
getColor(String,Color), getColorArray(String), Color

getFile

public File getFile(String id)
Returns the first File value associated with the specified id.

Parameters:
id - the id of the File value to retrieve
Returns:
the File value associated with the specified id.
See Also:
getFile(String,File), getFileArray(String), File

getColor

public Color getColor(String id,
                      Color defaultValue)
Returns the first Color value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.awt.Color, the specified default value is returned.

Parameters:
id - the id of the Color value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.lang.Color.
Returns:
the first Color value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.awt.Color, the specified default value is returned.
See Also:
getColor(String), getColorArray(String), Color

getFile

public File getFile(String id,
                    File defaultValue)
Returns the first File value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.io.File, the specified default value is returned.

Parameters:
id - the id of the File value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.io.File.
Returns:
the first File value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.io.File, the specified default value is returned.
See Also:
getFile(String), getFileArray(String), File

getColorArray

public Color[] getColorArray(String id)
Returns an array of Color values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the Color value(s) to return.
Returns:
an array containing the Color value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getColor(String), getColor(String,Color), Color

getFileArray

public File[] getFileArray(String id)
Returns an array of File values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the File value(s) to return.
Returns:
an array containing the File value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getFile(String), getFile(String,File), File

getDate

public Date getDate(String id)
Returns the first Date value associated with the specified id.

Parameters:
id - the id of the Date value to retrieve
Returns:
the Date value associated with the specified id.
See Also:
getDate(String,Date), getDateArray(String), Date

getDate

public Date getDate(String id,
                    Date defaultValue)
Returns the first Date value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.util.Date, the specified default value is returned.

Parameters:
id - the id of the Date value to retrieve
defaultValue - the value to return if the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.util.Date.
Returns:
the first Date value associated with the specified id. If the specified id does not exist within this JSAPResult, or if the object(s) associated with the specified id are not of type java.util.Date, the specified default value is returned.
See Also:
getDate(String), getDateArray(String), Date

getDateArray

public Date[] getDateArray(String id)
Returns an array of Date values associated with the specified id. If the specified id does not exist within this JSAPResult, this method returns an empty array (i.e., array.length==0).

Parameters:
id - the id of the Date value(s) to return.
Returns:
an array containing the Date value(s) associated with the specified id, or an empty array if the specified id does not exist within this JSAPResult.
See Also:
getDate(String), getDate(String,Date), Date

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.

Specified by:
getException in interface ExceptionMap
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.
See Also:
ExceptionMap.getException(String)

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.

Specified by:
getExceptionArray in interface ExceptionMap
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.
See Also:
ExceptionMap.getExceptionArray(String)

getExceptionIterator

public Iterator getExceptionIterator(String id)
Returns an Iterator ovar ALL exceptions associated with the specified parameter ID. If no exceptions are associated with the specified parameter ID, an empty iterator (NOT null) is returned.

Parameters:
id - the unique ID of the parameter for which the exceptions are requested.
Returns:
an Iterator over ALL exceptions associated with the specified parameter ID

getErrorMessageIterator

public Iterator getErrorMessageIterator()
Returns an iterator over all error messages generated during parsing. If no errors occured, the iterator will be empty.

Returns:
an iterator over all error messages generated during parsing.

getBadParameterIDIterator

public Iterator getBadParameterIDIterator()
Returns an Iterator over the IDs of all parameters with associated exceptions (which can in turn be obtained via getExceptionIterator(String)). General exceptions not associated with any particular parameter are associated with the null ID, so null may be returned by this Iterator.

Returns:
an Iterator over the IDs of all parameters with associated exceptions.

success

public boolean success()
Returns a boolean indicating whether the parse that produced this JSAPResult was successful. If this method returns false, detailed information regarding the reasons for the failed parse can be obtained via the getException() methods.

Returns:
a boolean indicating whether the parse that produced this JSAPResult was successful.


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