public class JSAPResult extends 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 | Constructor and Description |
---|---|
protected |
JSAPResult()
Creates new JSAPResult
|
Modifier and Type | Method and Description |
---|---|
protected void |
add(String id,
List values)
Adds the specified values to any existing values already associated with
the specified id, if any.
|
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.
|
public boolean contains(String id)
This is just a means to see if there are values to retrieve.
id
- the ID to checkpublic boolean userSpecified(String id)
id
- the ID to checkprotected void add(String id, List values)
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.public void addException(String id, 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 Object getObject(String id)
id
- the unique ID of the parameter for which the first value is
requestedpublic Object[] getObjectArray(String id)
id
- the unique ID of the parameter for which the values are
requestedpublic Object[] getObjectArray(String id, 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(String id)
id
- the id of the boolean value to retrievegetBoolean(String, boolean)
,
getBooleanArray(String)
public boolean getBoolean(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(String id)
id
- the id of the boolean value(s) to return.getBoolean(String)
,
getBoolean(String,boolean)
public int getInt(String id)
id
- the id of the integer value to retrievegetInt(String,int)
,
getIntArray(String)
public int getInt(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 String getQualifiedSwitchValue(String id)
id
- the unique ID of the parameter for which the value is requestedpublic int[] getIntArray(String id)
id
- the id of the integer value(s) to return.getInt(String)
,
getInt(String,int)
public long getLong(String id)
id
- the id of the long value to retrievegetLong(String,long)
,
getLongArray(String)
public long getLong(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(String id)
id
- the id of the long value(s) to return.getLong(String)
,
getLong(String,long)
public byte getByte(String id)
id
- the id of the byte value to retrievegetByte(String,byte)
,
getByteArray(String)
public byte getByte(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(String id)
id
- the id of the byte value(s) to return.getByte(String)
,
getByte(String,byte)
public char getChar(String id)
id
- the id of the char value to retrievegetChar(String,char)
,
getCharArray(String)
public char getChar(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(String id)
id
- the id of the char value(s) to return.getChar(String)
,
getChar(String,char)
public short getShort(String id)
id
- the id of the short value to retrievegetShort(String,short)
,
getShortArray(String)
public short getShort(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(String id)
id
- the id of the short value(s) to return.getShort(String)
,
getShort(String,short)
public double getDouble(String id)
id
- the id of the double value to retrievegetDouble(String,double)
,
getDoubleArray(String)
public double getDouble(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(String id)
id
- the id of the double value(s) to return.getDouble(String)
,
getDouble(String,double)
public float getFloat(String id)
id
- the id of the float value to retrievegetFloat(String,float)
,
getFloatArray(String)
public float getFloat(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(String id)
id
- the id of the float value(s) to return.getFloat(String)
,
getFloat(String,float)
public String getString(String id)
id
- the id of the String value to retrievegetString(String,String)
,
getStringArray(String)
public String getString(String id, 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 String[] getStringArray(String id)
id
- the id of the String value(s) to return.getString(String)
,
getString(String,String)
public BigDecimal getBigDecimal(String id)
id
- the id of the BigDecimal value to retrievegetBigDecimal(String, BigDecimal)
,
getBigDecimalArray(String)
,
BigDecimal
public BigDecimal getBigDecimal(String id, 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 BigDecimal[] getBigDecimalArray(String id)
id
- the id of the BigDecimal value(s) to return.getBigDecimal(String)
,
getBigDecimal(String,BigDecimal)
,
BigDecimal
public BigInteger getBigInteger(String id)
id
- the id of the BigInteger value to retrievegetBigInteger(String, BigInteger)
,
getBigIntegerArray(String)
,
BigInteger
public BigInteger getBigInteger(String id, 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 BigInteger[] getBigIntegerArray(String id)
id
- the id of the BigInteger value(s) to return.getBigInteger(String)
,
getBigInteger(String,BigInteger)
,
BigInteger
public Class getClass(String id)
id
- the id of the Class value to retrievegetClass(String, Class)
,
getClassArray(String)
,
Class
public Class getClass(String id, 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 Class[] getClassArray(String id)
id
- the id of the Class value(s) to return.getClass(String)
,
getClass(String,Class)
,
Class
public InetAddress getInetAddress(String id)
id
- the id of the InetAddress value to retrievegetInetAddress(String, InetAddress)
,
getInetAddressArray(String)
,
InetAddress
public InetAddress getInetAddress(String id, 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 InetAddress[] getInetAddressArray(String id)
id
- the id of the InetAddress value(s) to return.getInetAddress(String)
,
getInetAddress(String,InetAddress)
,
InetAddress
public Package getPackage(String id)
id
- the id of the Package value to retrievegetPackage(String, Package)
,
getPackageArray(String)
,
Package
public Package getPackage(String id, 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 Package[] getPackageArray(String id)
id
- the id of the Package value(s) to return.getPackage(String)
,
getPackage(String,Package)
,
Package
public URL getURL(String id)
id
- the id of the URL value to retrievegetURL(String,URL)
,
getURLArray(String)
,
URL
public URL getURL(String id, 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 URL[] getURLArray(String id)
id
- the id of the URL value(s) to return.getURL(String)
,
getURL(String,URL)
,
URL
public Color getColor(String id)
id
- the id of the Color value to retrievegetColor(String,Color)
,
getColorArray(String)
,
Color
public File getFile(String id)
id
- the id of the File value to retrievegetFile(String,File)
,
getFileArray(String)
,
File
public Color getColor(String id, 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 File getFile(String id, 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 Color[] getColorArray(String id)
id
- the id of the Color value(s) to return.getColor(String)
,
getColor(String,Color)
,
Color
public File[] getFileArray(String id)
id
- the id of the File value(s) to return.getFile(String)
,
getFile(String,File)
,
File
public Date getDate(String id)
id
- the id of the Date value to retrievegetDate(String,Date)
,
getDateArray(String)
,
Date
public Date getDate(String id, 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 Date[] getDateArray(String id)
id
- the id of the Date value(s) to return.getDate(String)
,
getDate(String,Date)
,
Date
public Exception getException(String id)
getException
in interface ExceptionMap
id
- the unique ID of the parameter for which the first exception
is requestedExceptionMap.getException(String)
public Exception[] getExceptionArray(String id)
getExceptionArray
in interface ExceptionMap
id
- the unique ID of the parameter for which the exceptions are
requested.ExceptionMap.getExceptionArray(String)
public Iterator getExceptionIterator(String id)
id
- the unique ID of the parameter for which the exceptions are
requested.public Iterator getErrorMessageIterator()
public Iterator getBadParameterIDIterator()
public boolean success()
Copyright © 2015. All rights reserved.