Package com.martiansoftware.jsap
Class JSAPResult
- java.lang.Object
-
- com.martiansoftware.jsap.JSAPResult
-
- All Implemented Interfaces:
ExceptionMap
public class JSAPResult extends java.lang.Object implements ExceptionMap
Encapsulates the results of JSAP's parse() methods. The most basic means of obtaining a parse result from a JSAPResult is thegetObject(String)
method, but a number of getXXX() methods are provided to make your code more readable and to avoid re-casting.- Author:
- Marty Lamb
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
JSAPResult()
Creates new JSAPResult
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
add(java.lang.String id, java.util.List values)
Adds the specified values to any existing values already associated with the specified id, if any.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.
-
-
-
Method Detail
-
contains
public boolean contains(java.lang.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(java.lang.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.
-
add
protected void add(java.lang.String id, java.util.List values)
Adds the specified values to any existing values already associated with the specified id, if any.- Parameters:
id
- the unique ID of the parameter with which the specified values are associated.values
- a List containing the additional values to associate with the specified ID.
-
addException
public void addException(java.lang.String id, java.lang.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 interfaceExceptionMap
- 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 java.lang.Object getObject(java.lang.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 java.lang.Object[] getObjectArray(java.lang.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 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. 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 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.- 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(java.lang.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(java.lang.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 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.- 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(java.lang.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(java.lang.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(java.lang.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 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.- 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 java.lang.String getQualifiedSwitchValue(java.lang.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(java.lang.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(java.lang.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(java.lang.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 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.- 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(java.lang.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(java.lang.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(java.lang.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 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.- 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(java.lang.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(java.lang.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(java.lang.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 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.- 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(java.lang.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(java.lang.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(java.lang.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 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.- 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(java.lang.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(java.lang.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(java.lang.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 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.- 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(java.lang.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(java.lang.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(java.lang.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 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.- 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(java.lang.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 java.lang.String getString(java.lang.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 java.lang.String getString(java.lang.String id, java.lang.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 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.- 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 java.lang.String[] getStringArray(java.lang.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 java.math.BigDecimal getBigDecimal(java.lang.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 java.math.BigDecimal getBigDecimal(java.lang.String id, java.math.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 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.- 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 java.math.BigDecimal[] getBigDecimalArray(java.lang.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 java.math.BigInteger getBigInteger(java.lang.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 java.math.BigInteger getBigInteger(java.lang.String id, java.math.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 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.- 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 java.math.BigInteger[] getBigIntegerArray(java.lang.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 java.lang.Class getClass(java.lang.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 java.lang.Class getClass(java.lang.String id, java.lang.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 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.- 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 java.lang.Class[] getClassArray(java.lang.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 java.net.InetAddress getInetAddress(java.lang.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 java.net.InetAddress getInetAddress(java.lang.String id, java.net.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 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.- 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 java.net.InetAddress[] getInetAddressArray(java.lang.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 java.lang.Package getPackage(java.lang.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 java.lang.Package getPackage(java.lang.String id, java.lang.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 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.- 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 java.lang.Package[] getPackageArray(java.lang.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 java.net.URL getURL(java.lang.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 java.net.URL getURL(java.lang.String id, java.net.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 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.- 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 java.net.URL[] getURLArray(java.lang.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 java.awt.Color getColor(java.lang.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 java.io.File getFile(java.lang.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 java.awt.Color getColor(java.lang.String id, java.awt.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 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.- 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 java.io.File getFile(java.lang.String id, java.io.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 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.- 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 java.awt.Color[] getColorArray(java.lang.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 java.io.File[] getFileArray(java.lang.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 java.util.Date getDate(java.lang.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 java.util.Date getDate(java.lang.String id, java.util.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 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.- 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 java.util.Date[] getDateArray(java.lang.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 java.lang.Exception getException(java.lang.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 interfaceExceptionMap
- 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 java.lang.Exception[] getExceptionArray(java.lang.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 interfaceExceptionMap
- 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 java.util.Iterator getExceptionIterator(java.lang.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 java.util.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 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)). 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.
-
-