|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.oreodata.AbstractRecord
An abstract base implementation of the Record interface In this implementation, the records can be written out as a human-readable string. This is the scheme used for serialization. DefaultRecord implements the java.io.Externalizable interface in order to avoid the general-purpose serialization scheme. The goal was that the resulting storage format should be human-readable and modifiable in a text editor in a pinch.
| Field Summary |
| Fields inherited from interface org.oreodata.OreoConstants |
RECORD_STATUS_KEY, RECORD_TYPE_KEY |
| Constructor Summary | |
AbstractRecord()
|
|
| Method Summary | |
void |
checkValidity()
Check if the record's data is valid. |
void |
clearFields()
set the fields to their default values. |
boolean |
equals(java.lang.Object o)
|
void |
freeze()
make this record immutable. |
java.lang.Object |
get(FieldDescriptor field)
Low-level method to query the value of a field in a Record. |
protected abstract java.lang.Object |
get(int i)
|
java.lang.Object |
get(java.lang.Object o)
|
java.lang.Object |
get(java.lang.String fieldname)
Method to get the value of a field by name. |
java.util.List |
getChildren()
In this base implementation, this always returns an empty list. |
RecordDescriptor |
getMetadata()
|
Record |
getMutableCopy()
create a clone. |
Record |
getParent()
In this base implementation, this always returns null. |
java.lang.Object |
getPrimaryKey()
Retrieve the value of the record's primary key. |
java.lang.String |
getType()
|
boolean |
hasChildren()
In this base implementation, this always returns false. |
boolean |
isRootElement()
In this base implementation, this always returns true. |
boolean |
isStale()
Has this record been deleted or superseded in the associated DataSource? |
protected void |
postCheck()
Called after checking the fields. |
protected void |
preCheck()
Called before checking the fields. |
void |
readExternal(java.io.ObjectInput in)
|
void |
set(FieldDescriptor field,
java.lang.Object value)
Low-level method to set an individual field value |
protected abstract void |
set(int i,
java.lang.Object value)
|
void |
set(java.lang.String fieldname,
java.lang.Object value)
Method to set the value of a field by name. |
void |
setMetadata(RecordDescriptor descriptor)
Method only used internally. |
void |
setPrimaryKey(java.lang.Object o)
set the value of this record's primary key. |
java.lang.String |
setValuesFromTable(java.util.Map table)
Set the values of the record's fields from a key-value mapping of the fields (or field names) to values. |
java.lang.String |
toString()
Provides a default string representation of the record for a human-readable flat-file persistence scheme. |
void |
writeExternal(java.io.ObjectOutput out)
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.oreodata.Record |
isImmutable |
| Constructor Detail |
public AbstractRecord()
| Method Detail |
public final void checkValidity()
throws DataException
DataException - if any of the fields are not valid.
The appropriate error message is encoded in the exception.public boolean isStale()
Record
isStale in interface Recordpublic java.lang.Object getPrimaryKey()
Record
getPrimaryKey in interface Recordpublic void setPrimaryKey(java.lang.Object o)
Record
setPrimaryKey in interface Recordpublic java.lang.String toString()
toString in class java.lang.Object
protected void preCheck()
throws DataException
DataException
protected void postCheck()
throws DataException
DataException
public void freeze()
throws DataException
Record
freeze in interface RecordDataException
public java.lang.String setValuesFromTable(java.util.Map table)
throws DataException
table - key-value string pairs to set values of fields.
DataExceptionpublic final java.lang.Object get(java.lang.String fieldname)
Record
get in interface Recordfieldname - public final java.lang.Object get(FieldDescriptor field)
Record
get in interface Recordfield - to query.
public final void set(java.lang.String fieldname,
java.lang.Object value)
Record
set in interface Recordfieldname - the name of the field to set.
public final void set(FieldDescriptor field,
java.lang.Object value)
Record
set in interface Recordfield - to set.value - Object wrapping the valuepublic final RecordDescriptor getMetadata()
getMetadata in interface RecordRecordDescriptor
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOException
java.lang.ClassNotFoundException
public Record getParent()
throws MissingContextException
getParent in interface RecordMissingContextException
public java.util.List getChildren()
throws MissingContextException
getChildren in interface RecordMissingContextExceptionpublic boolean isRootElement()
isRootElement in interface Recordpublic boolean hasChildren()
hasChildren in interface Record
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOExceptionpublic Record getMutableCopy()
getMutableCopy in interface Recordpublic java.lang.Object get(java.lang.Object o)
public void clearFields()
clearFields in interface Recordpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic void setMetadata(RecordDescriptor descriptor)
Record
setMetadata in interface Recordpublic final java.lang.String getType()
getType in interface Recordprotected abstract java.lang.Object get(int i)
protected abstract void set(int i,
java.lang.Object value)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||