public class JSAPResult extends java.lang.Object implements ExceptionMap
getObject(String)
method, but a number of getXXX() methods are provided
to make your code more readable and to avoid re-casting.Modifier and Type | Method and Description |
---|---|
void |
addException(java.lang.String id,
java.lang.Exception exception)
Adds the specified exception to the exception map.
|
boolean |
contains(java.lang.String id)
Returns true if this JSAPResult contains any results for
the specified id.
|
java.util.Iterator |
getBadParameterIDIterator()
Returns an Iterator over the IDs of all parameters with associated
exceptions (which can in turn be obtained via
getExceptionIterator(String)).
|
java.math.BigDecimal |
getBigDecimal(java.lang.String id)
Returns the first BigDecimal value associated with the specified id.
|
java.math.BigDecimal |
getBigDecimal(java.lang.String id,
java.math.BigDecimal defaultValue)
Returns the first BigDecimal value associated with the specified id.
|
java.math.BigDecimal[] |
getBigDecimalArray(java.lang.String id)
Returns an array of BigDecimal values associated with the specified id.
|
java.math.BigInteger |
getBigInteger(java.lang.String id)
Returns the first BigInteger value associated with the specified id.
|
java.math.BigInteger |
getBigInteger(java.lang.String id,
java.math.BigInteger defaultValue)
Returns the first BigInteger value associated with the specified id.
|
java.math.BigInteger[] |
getBigIntegerArray(java.lang.String id)
Returns an array of BigInteger values associated with the specified id.
|
boolean |
getBoolean(java.lang.String id)
Returns the first boolean value associated with the specified id.
|
boolean |
getBoolean(java.lang.String id,
boolean defaultValue)
Returns the first boolean value associated with the specified id.
|
boolean[] |
getBooleanArray(java.lang.String id)
Returns an array of boolean values associated with the specified id.
|
byte |
getByte(java.lang.String id)
Returns the first byte value associated with the specified id.
|
byte |
getByte(java.lang.String id,
byte defaultValue)
Returns the first byte value associated with the specified id.
|
byte[] |
getByteArray(java.lang.String id)
Returns an array of byte values associated with the specified id.
|
char |
getChar(java.lang.String id)
Returns the first char value associated with the specified id.
|
char |
getChar(java.lang.String id,
char defaultValue)
Returns the first char value associated with the specified id.
|
char[] |
getCharArray(java.lang.String id)
Returns an array of char values associated with the specified id.
|
java.lang.Class |
getClass(java.lang.String id)
Returns the first Class value associated with the specified id.
|
java.lang.Class |
getClass(java.lang.String id,
java.lang.Class defaultValue)
Returns the first Class value associated with the specified id.
|
java.lang.Class[] |
getClassArray(java.lang.String id)
Returns an array of Class values associated with the specified id.
|
java.awt.Color |
getColor(java.lang.String id)
Returns the first Color value associated with the specified id.
|
java.awt.Color |
getColor(java.lang.String id,
java.awt.Color defaultValue)
Returns the first Color value associated with the specified id.
|
java.awt.Color[] |
getColorArray(java.lang.String id)
Returns an array of Color values associated with the specified id.
|
java.util.Date |
getDate(java.lang.String id)
Returns the first Date value associated with the specified id.
|
java.util.Date |
getDate(java.lang.String id,
java.util.Date defaultValue)
Returns the first Date value associated with the specified id.
|
java.util.Date[] |
getDateArray(java.lang.String id)
Returns an array of Date values associated with the specified id.
|
double |
getDouble(java.lang.String id)
Returns the first double value associated with the specified id.
|
double |
getDouble(java.lang.String id,
double defaultValue)
Returns the first double value associated with the specified id.
|
double[] |
getDoubleArray(java.lang.String id)
Returns an array of double values associated with the specified id.
|
java.util.Iterator |
getErrorMessageIterator()
Returns an iterator over all error messages generated during parsing.
|
java.lang.Exception |
getException(java.lang.String id)
Returns the first exception associated with the specified parameter ID.
|
java.lang.Exception[] |
getExceptionArray(java.lang.String id)
Returns an array of ALL exceptions associated with the specified
parameter ID.
|
java.util.Iterator |
getExceptionIterator(java.lang.String id)
Returns an Iterator ovar ALL exceptions associated with the specified
parameter ID.
|
java.io.File |
getFile(java.lang.String id)
Returns the first File value associated with the specified id.
|
java.io.File |
getFile(java.lang.String id,
java.io.File defaultValue)
Returns the first File value associated with the specified id.
|
java.io.File[] |
getFileArray(java.lang.String id)
Returns an array of File values associated with the specified id.
|
float |
getFloat(java.lang.String id)
Returns the first float value associated with the specified id.
|
float |
getFloat(java.lang.String id,
float defaultValue)
Returns the first float value associated with the specified id.
|
float[] |
getFloatArray(java.lang.String id)
Returns an array of float values associated with the specified id.
|
java.net.InetAddress |
getInetAddress(java.lang.String id)
Returns the first InetAddress value associated with the specified id.
|
java.net.InetAddress |
getInetAddress(java.lang.String id,
java.net.InetAddress defaultValue)
Returns the first InetAddress value associated with the specified id.
|
java.net.InetAddress[] |
getInetAddressArray(java.lang.String id)
Returns an array of InetAddress values associated with the specified id.
|
int |
getInt(java.lang.String id)
Returns the first integer value associated with the specified id.
|
int |
getInt(java.lang.String id,
int defaultValue)
Returns the first integer value associated with the specified id.
|
int[] |
getIntArray(java.lang.String id)
Returns an array of integer values associated with the specified id.
|
long |
getLong(java.lang.String id)
Returns the first long value associated with the specified id.
|
long |
getLong(java.lang.String id,
long defaultValue)
Returns the first long value associated with the specified id.
|
long[] |
getLongArray(java.lang.String id)
Returns an array of long values associated with the specified id.
|
java.lang.Object |
getObject(java.lang.String id)
Returns the first object associated with the specified ID.
|
java.lang.Object[] |
getObjectArray(java.lang.String id)
Returns all values associated with the specified ID.
|
java.lang.Object[] |
getObjectArray(java.lang.String id,
java.lang.Object[] a)
Returns an array containing all of the values associated with the
specified ID.
|
java.lang.Package |
getPackage(java.lang.String id)
Returns the first Package value associated with the specified id.
|
java.lang.Package |
getPackage(java.lang.String id,
java.lang.Package defaultValue)
Returns the first Package value associated with the specified id.
|
java.lang.Package[] |
getPackageArray(java.lang.String id)
Returns an array of Package values associated with the specified id.
|
java.lang.String |
getQualifiedSwitchValue(java.lang.String id)
Returns the string value associated with the specified ID for QualifiedSwitches.
|
short |
getShort(java.lang.String id)
Returns the first short value associated with the specified id.
|
short |
getShort(java.lang.String id,
short defaultValue)
Returns the first short value associated with the specified id.
|
short[] |
getShortArray(java.lang.String id)
Returns an array of short values associated with the specified id.
|
java.lang.String |
getString(java.lang.String id)
Returns the first String value associated with the specified id.
|
java.lang.String |
getString(java.lang.String id,
java.lang.String defaultValue)
Returns the first String value associated with the specified id.
|
java.lang.String[] |
getStringArray(java.lang.String id)
Returns an array of String values associated with the specified id.
|
java.net.URL |
getURL(java.lang.String id)
Returns the first URL value associated with the specified id.
|
java.net.URL |
getURL(java.lang.String id,
java.net.URL defaultValue)
Returns the first URL value associated with the specified id.
|
java.net.URL[] |
getURLArray(java.lang.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(java.lang.String id)
Returns true if this JSAPResult contains any user-specified
values for the specified id.
|
public boolean contains(java.lang.String id)
This is just a means to see if there are values to retrieve.
id
- the ID to checkpublic boolean userSpecified(java.lang.String id)
id
- the ID to checkpublic void addException(java.lang.String id, java.lang.Exception exception)
addException
in interface ExceptionMap
id
- the unique ID of the parameter with which the specified values
are associated.exception
- the exception to associate with the specified key.ExceptionMap.addException(String,Exception)
public java.lang.Object getObject(java.lang.String id)
id
- the unique ID of the parameter for which the first value is
requestedpublic java.lang.Object[] getObjectArray(java.lang.String id)
id
- the unique ID of the parameter for which the values are
requestedpublic java.lang.Object[] getObjectArray(java.lang.String id, java.lang.Object[] a)
id
- the unique ID of the parameter for which the values are
requesteda
- 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.public boolean getBoolean(java.lang.String id)
id
- the id of the boolean value to retrievegetBoolean(String, boolean)
,
getBooleanArray(String)
public boolean getBoolean(java.lang.String id, boolean defaultValue)
id
- the id of the boolean value to retrievedefaultValue
- 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.getBoolean(String)
,
getBooleanArray(String)
public boolean[] getBooleanArray(java.lang.String id)
id
- the id of the boolean value(s) to return.getBoolean(String)
,
getBoolean(String,boolean)
public int getInt(java.lang.String id)
id
- the id of the integer value to retrievegetInt(String,int)
,
getIntArray(String)
public int getInt(java.lang.String id, int defaultValue)
id
- the id of the boolean value to retrievedefaultValue
- 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.getInt(String)
,
getIntArray(String)
public java.lang.String getQualifiedSwitchValue(java.lang.String id)
id
- the unique ID of the parameter for which the value is requestedpublic int[] getIntArray(java.lang.String id)
id
- the id of the integer value(s) to return.getInt(String)
,
getInt(String,int)
public long getLong(java.lang.String id)
id
- the id of the long value to retrievegetLong(String,long)
,
getLongArray(String)
public long getLong(java.lang.String id, long defaultValue)
id
- the id of the long value to retrievedefaultValue
- 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.getLong(String)
,
getLongArray(String)
public long[] getLongArray(java.lang.String id)
id
- the id of the long value(s) to return.getLong(String)
,
getLong(String,long)
public byte getByte(java.lang.String id)
id
- the id of the byte value to retrievegetByte(String,byte)
,
getByteArray(String)
public byte getByte(java.lang.String id, byte defaultValue)
id
- the id of the byte value to retrievedefaultValue
- 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.getByte(String)
,
getByteArray(String)
public byte[] getByteArray(java.lang.String id)
id
- the id of the byte value(s) to return.getByte(String)
,
getByte(String,byte)
public char getChar(java.lang.String id)
id
- the id of the char value to retrievegetChar(String,char)
,
getCharArray(String)
public char getChar(java.lang.String id, char defaultValue)
id
- the id of the char value to retrievedefaultValue
- 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.getChar(String)
,
getCharArray(String)
public char[] getCharArray(java.lang.String id)
id
- the id of the char value(s) to return.getChar(String)
,
getChar(String,char)
public short getShort(java.lang.String id)
id
- the id of the short value to retrievegetShort(String,short)
,
getShortArray(String)
public short getShort(java.lang.String id, short defaultValue)
id
- the id of the short value to retrievedefaultValue
- 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.getShort(String)
,
getShortArray(String)
public short[] getShortArray(java.lang.String id)
id
- the id of the short value(s) to return.getShort(String)
,
getShort(String,short)
public double getDouble(java.lang.String id)
id
- the id of the double value to retrievegetDouble(String,double)
,
getDoubleArray(String)
public double getDouble(java.lang.String id, double defaultValue)
id
- the id of the double value to retrievedefaultValue
- 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.getDouble(String)
,
getDoubleArray(String)
public double[] getDoubleArray(java.lang.String id)
id
- the id of the double value(s) to return.getDouble(String)
,
getDouble(String,double)
public float getFloat(java.lang.String id)
id
- the id of the float value to retrievegetFloat(String,float)
,
getFloatArray(String)
public float getFloat(java.lang.String id, float defaultValue)
id
- the id of the float value to retrievedefaultValue
- 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.getFloat(String)
,
getFloatArray(String)
public float[] getFloatArray(java.lang.String id)
id
- the id of the float value(s) to return.getFloat(String)
,
getFloat(String,float)
public java.lang.String getString(java.lang.String id)
id
- the id of the String value to retrievegetString(String,String)
,
getStringArray(String)
public java.lang.String getString(java.lang.String id, java.lang.String defaultValue)
id
- the id of the String value to retrievedefaultValue
- 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.getString(String)
,
getStringArray(String)
public java.lang.String[] getStringArray(java.lang.String id)
id
- the id of the String value(s) to return.getString(String)
,
getString(String,String)
public java.math.BigDecimal getBigDecimal(java.lang.String id)
id
- the id of the BigDecimal value to retrievegetBigDecimal(String, BigDecimal)
,
getBigDecimalArray(String)
,
BigDecimal
public java.math.BigDecimal getBigDecimal(java.lang.String id, java.math.BigDecimal defaultValue)
id
- the id of the BigDecimal value to retrievedefaultValue
- 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.getBigDecimal(String)
,
getBigDecimalArray(String)
,
BigDecimal
public java.math.BigDecimal[] getBigDecimalArray(java.lang.String id)
id
- the id of the BigDecimal value(s) to return.getBigDecimal(String)
,
getBigDecimal(String,BigDecimal)
,
BigDecimal
public java.math.BigInteger getBigInteger(java.lang.String id)
id
- the id of the BigInteger value to retrievegetBigInteger(String, BigInteger)
,
getBigIntegerArray(String)
,
BigInteger
public java.math.BigInteger getBigInteger(java.lang.String id, java.math.BigInteger defaultValue)
id
- the id of the BigInteger value to retrievedefaultValue
- 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.getBigInteger(String)
,
getBigIntegerArray(String)
,
BigInteger
public java.math.BigInteger[] getBigIntegerArray(java.lang.String id)
id
- the id of the BigInteger value(s) to return.getBigInteger(String)
,
getBigInteger(String,BigInteger)
,
BigInteger
public java.lang.Class getClass(java.lang.String id)
id
- the id of the Class value to retrievegetClass(String, Class)
,
getClassArray(String)
,
Class
public java.lang.Class getClass(java.lang.String id, java.lang.Class defaultValue)
id
- the id of the Class value to retrievedefaultValue
- 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.getClass(String)
,
getClassArray(String)
,
Class
public java.lang.Class[] getClassArray(java.lang.String id)
id
- the id of the Class value(s) to return.getClass(String)
,
getClass(String,Class)
,
Class
public java.net.InetAddress getInetAddress(java.lang.String id)
id
- the id of the InetAddress value to retrievegetInetAddress(String, InetAddress)
,
getInetAddressArray(String)
,
InetAddress
public java.net.InetAddress getInetAddress(java.lang.String id, java.net.InetAddress defaultValue)
id
- the id of the InetAddress value to retrievedefaultValue
- 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.getInetAddress(String)
,
getInetAddressArray(String)
,
InetAddress
public java.net.InetAddress[] getInetAddressArray(java.lang.String id)
id
- the id of the InetAddress value(s) to return.getInetAddress(String)
,
getInetAddress(String,InetAddress)
,
InetAddress
public java.lang.Package getPackage(java.lang.String id)
id
- the id of the Package value to retrievegetPackage(String, Package)
,
getPackageArray(String)
,
Package
public java.lang.Package getPackage(java.lang.String id, java.lang.Package defaultValue)
id
- the id of the Package value to retrievedefaultValue
- 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.getPackage(String)
,
getPackageArray(String)
,
Package
public java.lang.Package[] getPackageArray(java.lang.String id)
id
- the id of the Package value(s) to return.getPackage(String)
,
getPackage(String,Package)
,
Package
public java.net.URL getURL(java.lang.String id)
id
- the id of the URL value to retrievegetURL(String,URL)
,
getURLArray(String)
,
URL
public java.net.URL getURL(java.lang.String id, java.net.URL defaultValue)
id
- the id of the URL value to retrievedefaultValue
- 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.getURL(String)
,
getURLArray(String)
,
URL
public java.net.URL[] getURLArray(java.lang.String id)
id
- the id of the URL value(s) to return.getURL(String)
,
getURL(String,URL)
,
URL
public java.awt.Color getColor(java.lang.String id)
id
- the id of the Color value to retrievegetColor(String,Color)
,
getColorArray(String)
,
Color
public java.io.File getFile(java.lang.String id)
id
- the id of the File value to retrievegetFile(String,File)
,
getFileArray(String)
,
File
public java.awt.Color getColor(java.lang.String id, java.awt.Color defaultValue)
id
- the id of the Color value to retrievedefaultValue
- 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.getColor(String)
,
getColorArray(String)
,
Color
public java.io.File getFile(java.lang.String id, java.io.File defaultValue)
id
- the id of the File value to retrievedefaultValue
- 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.getFile(String)
,
getFileArray(String)
,
File
public java.awt.Color[] getColorArray(java.lang.String id)
id
- the id of the Color value(s) to return.getColor(String)
,
getColor(String,Color)
,
Color
public java.io.File[] getFileArray(java.lang.String id)
id
- the id of the File value(s) to return.getFile(String)
,
getFile(String,File)
,
File
public java.util.Date getDate(java.lang.String id)
id
- the id of the Date value to retrievegetDate(String,Date)
,
getDateArray(String)
,
Date
public java.util.Date getDate(java.lang.String id, java.util.Date defaultValue)
id
- the id of the Date value to retrievedefaultValue
- 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.getDate(String)
,
getDateArray(String)
,
Date
public java.util.Date[] getDateArray(java.lang.String id)
id
- the id of the Date value(s) to return.getDate(String)
,
getDate(String,Date)
,
Date
public java.lang.Exception getException(java.lang.String id)
getException
in interface ExceptionMap
id
- the unique ID of the parameter for which the first exception
is requestedExceptionMap.getException(String)
public java.lang.Exception[] getExceptionArray(java.lang.String id)
getExceptionArray
in interface ExceptionMap
id
- the unique ID of the parameter for which the exceptions are
requested.ExceptionMap.getExceptionArray(String)
public java.util.Iterator getExceptionIterator(java.lang.String id)
id
- the unique ID of the parameter for which the exceptions are
requested.public java.util.Iterator getErrorMessageIterator()
public java.util.Iterator getBadParameterIDIterator()
public boolean success()
Copyright © 2002-2006, Martian Software, Inc.. All Rights Reserved.
For the latest version and documentation, please visit http://www.martiansoftware.com/jsap