|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.revusky.oreo.DefaultRecord
A concrete 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 | |
static java.lang.String |
STATUS_KEY
The special reserved name of the status pseudo-key. |
static java.lang.String |
TYPE_KEY
The special reserved name of the type pseudo-key. |
Constructor Summary | |
DefaultRecord()
|
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 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. |
RecordDescriptor |
getMetadata()
|
Record |
getMutableCopy()
create a clone. |
java.lang.Object |
getPrimaryKey()
Retrieve the value of the record's primary key. |
java.lang.String |
getType()
|
boolean |
isImmutable()
Once a record is immutable, attempts to change data will result in an ImmutableDataException being thrown. |
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 concrete implementations will probably wrap this. |
protected 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 |
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 |
Field Detail |
public static final java.lang.String TYPE_KEY
public static final java.lang.String STATUS_KEY
Constructor Detail |
public DefaultRecord()
Method Detail |
public boolean isImmutable()
isImmutable
in interface Record
public final void checkValidity() throws java.io.IOException
java.io.IOException
- if any of the fields are not valid.
The appropriate error message is encoded in the exception.public boolean isStale()
Record
isStale
in interface Record
public java.lang.Object getPrimaryKey()
Record
getPrimaryKey
in interface Record
com.revusky.oreo.Record
public void setPrimaryKey(java.lang.Object o)
Record
setPrimaryKey
in interface Record
public java.lang.String toString()
toString
in class java.lang.Object
protected void preCheck() throws java.io.IOException
protected void postCheck() throws java.io.IOException
public void freeze() throws java.io.IOException
Record
freeze
in interface Record
public final java.lang.Object get(java.lang.String fieldname)
Record
get
in interface Record
com.revusky.oreo.Record
fieldname
- InvalidFieldException
- if there is no field of that name.public final void set(java.lang.String fieldname, java.lang.Object value)
Record
set
in interface Record
com.revusky.oreo.Record
fieldname
- the name of the field to set.InvalidFieldException
- if there is no field of that name.ImmutableDataException
- if this record
is immutable @see #getMutableCopy()public final java.lang.Object get(FieldDescriptor field)
Record
get
in interface Record
com.revusky.oreo.Record
field
- to query.public final void set(FieldDescriptor field, java.lang.Object value)
Record
set
in interface Record
com.revusky.oreo.Record
field
- to set.value
- Object wrapping the valueInvalidFieldException
- if there is no field of that name.ImmutableDataException
- if this record
is immutable @see #getMutableCopy()public final RecordDescriptor getMetadata()
getMetadata
in interface Record
com.revusky.oreo.Record
RecordDescriptor
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
public Record getMutableCopy()
getMutableCopy
in interface Record
protected final void set(int i, java.lang.Object value)
protected final java.lang.Object get(int i)
public java.lang.Object get(java.lang.Object o)
public void clearFields()
clearFields
in interface Record
com.revusky.oreo.Record
ImmutableDataException
- if this record
is immutable @see #getMutableCopy()public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public final void setMetadata(RecordDescriptor descriptor)
Record
setMetadata
in interface Record
public final java.lang.String getType()
getType
in interface Record
com.revusky.oreo.Record
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |