|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.niggle.data.RecordReference
An object that represents a weak or soft reference to an underlying Record object. This object implements the Record interface by delegating calls to an underlying record. Most likely this class will be subclassed, since it will be necessary to implement the restoreReferent() method. However, this could still be useful on its own, since if the underlying record gets gc'ed, then the calls to the various get/set methods simply "page-fault" and the client code could simply catch the condition and recover. In any case, the presence of this base class should avoid the need to repeat the same delegation bubble-gum code all over the place.
| Field Summary | |
protected java.lang.ref.Reference |
ref
|
| Fields inherited from interface com.niggle.data.Record |
INVALID_ID, STATUS_KEY, TYPE_KEY |
| Constructor Summary | |
RecordReference(Record underlying)
|
|
RecordReference(Record underlying,
java.lang.ref.ReferenceQueue queue)
|
|
| Method Summary | |
void |
clearFields()
reset the fields to their default state The record must be in a mutable state. |
java.lang.ref.Reference |
createReference(Record rec,
java.lang.ref.ReferenceQueue queue)
|
boolean |
equals(java.lang.Object o)
|
java.lang.Object |
get(FieldDescriptor field)
Low-level method to query the value of a field in a Record. |
java.lang.Object |
get(int i)
Low-level method to get the value of a field. |
java.lang.Object |
get(java.lang.String fieldName)
Low-level method to set the value of a field. |
java.util.Date |
getCreationDate()
convenience method that returns the value of the field that holds the record's creation timestamp. |
java.util.Locale |
getDisplayLocale()
|
java.util.Date |
getLastModified()
convenience method that returns the value of the field that holds the record's last modified timestamp. |
RecordDescriptor |
getMetadata()
|
Record |
getMutableCopy()
create a clone. |
java.lang.Object |
getPrimaryKey()
Retrieve the value of the record's primary key. |
java.lang.String |
getType()
|
Record |
getUnderlyingRecord()
|
int |
getVersion()
a hook to be used by versioning schemes. |
boolean |
isImmutable()
Have the fields all been set? Once a record is put in a DataSource, its fields are immutable. |
boolean |
isStale()
Has this record been deleted or superseded in the associated DataSource? |
Record |
restoreReferent(java.lang.String type,
int version,
java.lang.Object primaryKey)
A method that should restore the referent (i.e. |
void |
set(FieldDescriptor field,
java.lang.Object o)
Low-level method to set an individual field value concrete implementations will probably wrap this. |
void |
set(int i,
java.lang.Object o)
Low-level method to set the value of a field. |
void |
set(java.lang.String fieldName,
java.lang.Object o)
Low-level method to set the value of a field. |
void |
setMetadata(RecordDescriptor desc)
Method only used internally by niggle. |
void |
setPrimaryKey(java.lang.Object o)
set the value of this record's primary key. |
java.lang.String |
toString()
|
void |
touch()
mark this record as having just been modified. |
protected void |
updateCacheInfo(Record rec)
updates the information held in the reference wrapper. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.lang.ref.Reference ref
| Constructor Detail |
public RecordReference(Record underlying)
public RecordReference(Record underlying,
java.lang.ref.ReferenceQueue queue)
| Method Detail |
public java.lang.ref.Reference createReference(Record rec,
java.lang.ref.ReferenceQueue queue)
public Record getUnderlyingRecord()
public Record restoreReferent(java.lang.String type,
int version,
java.lang.Object primaryKey)
protected void updateCacheInfo(Record rec)
public java.lang.Object get(java.lang.String fieldName)
Recordget in interface Recordcom.niggle.data.Recordfieldname - InvalidFieldException - if there is no field of that name.public java.lang.Object get(int i)
Recordget in interface Recordpublic java.lang.Object get(FieldDescriptor field)
Recordget in interface Recordcom.niggle.data.Recordfield - to query.
public void set(java.lang.String fieldName,
java.lang.Object o)
Recordset in interface Recordcom.niggle.data.Recordfieldname - 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 void set(int i,
java.lang.Object o)
Recordset in interface Recordcom.niggle.data.RecordImmutableDataException - if this record
is immutable @see #getMutableCopy()
public void set(FieldDescriptor field,
java.lang.Object o)
Recordset in interface Recordcom.niggle.data.Recordfield - to set.value - Object wrapping the valueInvalidFieldException - if there is no field of that name.ImmutableDataException - if this record
is immutable @see #getMutableCopy()public void clearFields()
RecordclearFields in interface Recordcom.niggle.data.RecordImmutableDataException - if this record
is immutable @see #getMutableCopy()public java.util.Locale getDisplayLocale()
getDisplayLocale in interface Recordcom.niggle.data.Recordpublic RecordDescriptor getMetadata()
getMetadata in interface Recordcom.niggle.data.RecordRecordDescriptorpublic Record getMutableCopy()
RecordgetMutableCopy in interface Recordpublic boolean isStale()
RecordisStale in interface Recordpublic java.util.Date getCreationDate()
RecordgetCreationDate in interface Recordpublic java.util.Date getLastModified()
RecordgetLastModified in interface Recordpublic java.lang.Object getPrimaryKey()
RecordgetPrimaryKey in interface Recordcom.niggle.data.Recordpublic void setPrimaryKey(java.lang.Object o)
RecordsetPrimaryKey in interface Recordpublic int getVersion()
RecordgetVersion in interface Recordpublic boolean isImmutable()
RecordisImmutable in interface Recordpublic java.lang.String getType()
getType in interface Recordcom.niggle.data.Recordpublic void touch()
Recordtouch in interface Recordpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic void setMetadata(RecordDescriptor desc)
RecordsetMetadata in interface Record
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||