|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--gov.sns.tools.data.GenericRecord
GenericRecord is the default record class for DataTable. This class can be used directly for the records or a subclass of GenericRecord may be used for convenience. GenericRecord stores its data as key/value pairs.
| Nested Class Summary | |
class |
GenericRecord.ParseException
A runtime exception thrown while attempting to parse values stored as strings into an object of the appropriate type. |
| Field Summary | |
protected java.util.Map |
attributeTable
|
protected DataTable |
table
|
| Constructor Summary | |
GenericRecord(DataTable aTable)
Creates new GenericRecord |
|
| Method Summary | |
boolean |
booleanValueForKey(java.lang.String key)
Convenience method to get the value as a boolean associated with the specified key. |
java.lang.String |
dataLabel()
dataLabel() provides the name used to identify the class in an external data source. |
double |
doubleValueForKey(java.lang.String key)
Convenience method to get the value as a double associated with the specified key. |
int |
intValueForKey(java.lang.String key)
Convenience method to get the value as an int associated with the specified key. |
java.util.Set |
keys()
Get the keys used in this record. |
long |
longValueForKey(java.lang.String key)
Convenience method to get the value as a long associated with the specified key. |
java.lang.Number |
numberForKey(java.lang.String key)
Convenience method to get the value cast as a number associated with the specified key. |
void |
setValueForKey(boolean value,
java.lang.String key)
Set the boolean value to associate with the specified key. |
void |
setValueForKey(double value,
java.lang.String key)
Set the double value to associate with the specified key. |
void |
setValueForKey(int value,
java.lang.String key)
Set the int value to associate with the specified key. |
void |
setValueForKey(long value,
java.lang.String key)
Set the long value to associate with the specified key. |
void |
setValueForKey(java.lang.Object value,
java.lang.String key)
Set the value to associate with the specified key. |
java.lang.String |
stringValueForKey(java.lang.String key)
Convenience method to get the value as a String associated with the specified key. |
java.lang.String |
toString()
Overrides toString() to show key/value pairs. |
void |
update(DataAdaptor adaptor)
Update the data based on the information provided by the data provider. |
java.lang.Object |
valueForKey(java.lang.String key)
Get the value associated with the specified key. |
java.util.Collection |
values()
Get the collection of values held in this record. |
void |
write(DataAdaptor adaptor)
Write data to the data adaptor for storage. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected DataTable table
protected java.util.Map attributeTable
| Constructor Detail |
public GenericRecord(DataTable aTable)
| Method Detail |
public java.util.Set keys()
public java.util.Collection values()
public java.lang.Object valueForKey(java.lang.String key)
key - The key for which to get the associated value.
public void setValueForKey(java.lang.Object value,
java.lang.String key)
value - The new value to associate with the specified key.key - The key for which to associated the new value.public java.lang.Number numberForKey(java.lang.String key)
key - The key for which to get the associated value.
java.lang.ClassCastException - if the value cannot be cast as a Number.public boolean booleanValueForKey(java.lang.String key)
key - The key for which to get the associated value.
java.lang.ClassCastException - if the value cannot be cast as a Boolean.
public void setValueForKey(boolean value,
java.lang.String key)
value - The new boolean value to associate with the specified key.key - The key for which to associated the new value.public int intValueForKey(java.lang.String key)
key - The key for which to get the associated value.
java.lang.ClassCastException - if the value cannot be cast as a Number.
public void setValueForKey(int value,
java.lang.String key)
value - The new int value to associate with the specified key.key - The key for which to associated the new value.public long longValueForKey(java.lang.String key)
key - The key for which to get the associated value.
java.lang.ClassCastException - if the value cannot be cast as a Number.
public void setValueForKey(long value,
java.lang.String key)
value - The new long value to associate with the specified key.key - The key for which to associated the new value.public double doubleValueForKey(java.lang.String key)
key - The key for which to get the associated value.
java.lang.ClassCastException - if the value cannot be cast as a Number.
public void setValueForKey(double value,
java.lang.String key)
value - The new double value to associate with the specified key.key - The key for which to associated the new value.public java.lang.String stringValueForKey(java.lang.String key)
key - The key for which to get the associated value.
java.lang.ClassCastException - if the value cannot be cast as a String.public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String dataLabel()
dataLabel in interface DataListener
public void update(DataAdaptor adaptor)
throws GenericRecord.ParseException
update in interface DataListeneradaptor - The adaptor from which to update the data
GenericRecord.ParseExceptionpublic void write(DataAdaptor adaptor)
write in interface DataListeneradaptor - The adaptor to which the receiver's data is written
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||