org.jcon.data
Class ArrayListRecord

java.lang.Object
  extended by org.jcon.data.ArrayListRecord
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Record

public abstract class ArrayListRecord
extends java.lang.Object
implements Record

This is a Record whose values are maintained in an internal ArrayList. It should be less space-intensive than a HashRecord.

Author:
Paul Reavis
See Also:
Serialized Form

Constructor Summary
ArrayListRecord()
           
 
Method Summary
 java.lang.Object clone()
          Clones the Record.
 java.util.Iterator editableFields()
          A list of FieldDefs describing all the editable (readable and writable) fields in this Record.
protected abstract  java.util.Map editableFieldsDict()
           
 java.util.Map getAllFieldValues()
          Field values for all editable fields.
 FieldDef getField(java.lang.String fieldName)
          Returns a FieldDef for the given field.
 java.lang.Object getFieldValue(java.lang.String fieldName)
          Gets the value for a given field.
 java.util.Map getFieldValues()
          Field values for all readable fields.
protected  int indexOf(java.lang.String fieldName)
           
 java.util.Iterator readableFields()
          A list of FieldDefs describing all the readable fields in this Record.
protected abstract  java.util.Map readableFieldsDict()
           
 void setFieldValue(java.lang.String fieldName, java.lang.Object value)
          Sets the value for a given field.
 void setFieldValues(java.util.Map newFields)
          Sets field values.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayListRecord

public ArrayListRecord()
Method Detail

getField

public FieldDef getField(java.lang.String fieldName)
Returns a FieldDef for the given field.

Specified by:
getField in interface Record

readableFields

public java.util.Iterator readableFields()
A list of FieldDefs describing all the readable fields in this Record.

Specified by:
readableFields in interface Record

editableFields

public java.util.Iterator editableFields()
A list of FieldDefs describing all the editable (readable and writable) fields in this Record.

Specified by:
editableFields in interface Record

getFieldValue

public java.lang.Object getFieldValue(java.lang.String fieldName)
                               throws NoSuchFieldInRecordException
Gets the value for a given field.

Specified by:
getFieldValue in interface Record
Throws:
NoSuchFieldInRecordException

setFieldValue

public void setFieldValue(java.lang.String fieldName,
                          java.lang.Object value)
                   throws NoSuchFieldInRecordException,
                          java.lang.IllegalArgumentException
Sets the value for a given field.

Specified by:
setFieldValue in interface Record
Throws:
NoSuchFieldInRecordException
java.lang.IllegalArgumentException

getFieldValues

public java.util.Map getFieldValues()
Field values for all readable fields.

Specified by:
getFieldValues in interface Record

getAllFieldValues

public java.util.Map getAllFieldValues()
Field values for all editable fields.

Specified by:
getAllFieldValues in interface Record

setFieldValues

public void setFieldValues(java.util.Map newFields)
Sets field values. Unlisted fields are set to null; to leave a field unchanged associate it with a LeaveAloneToken

Invalid fields are ignored.

Specified by:
setFieldValues in interface Record
Parameters:
newFields - A dictionary of fieldnames associated with their values.

clone

public java.lang.Object clone()
Clones the Record.

Specified by:
clone in interface Record
Overrides:
clone in class java.lang.Object

readableFieldsDict

protected abstract java.util.Map readableFieldsDict()

editableFieldsDict

protected abstract java.util.Map editableFieldsDict()

indexOf

protected int indexOf(java.lang.String fieldName)