|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.starhope.appius.game.SimpleDataEnumSQLLoader<T,L>
T
- the data record classL
- the child classpublic abstract class SimpleDataEnumSQLLoader<T extends SimpleDataEnum<?>,L extends SimpleDataEnumSQLLoader<T,?>>
WRITEME: Document this type.
Field Summary | |
---|---|
private String |
idColumn
WRITEME: Document this brpocock@star-hope.org |
private String |
nameColumn
WRITEME: Document this brpocock@star-hope.org |
private String |
tableName
WRITEME: Document this brpocock@star-hope.org |
Constructor Summary | |
---|---|
protected |
SimpleDataEnumSQLLoader(String theTableName,
String theIDColumnName,
String theNameColumnName)
Constructor to be used by child classes |
Method Summary | |
---|---|
void |
changed(T changedRecord)
accept a notification from a record that it has been changed. |
protected abstract Class<T> |
getRecordClass()
|
protected abstract Class<L> |
getRecordLoaderImplClass()
|
private T |
getRecordObject()
|
String |
getSubversionRevision()
Return the Subversion revision level of this class's source code file, as supplied via the special "$Rev: " sequence. |
void |
initializeStorage(String storageURL)
Prepare the RecordLoader for accessing a given storage medium. |
boolean |
isRealtime()
|
T |
loadRecord(int id)
Load the record with the given ID number from the storage system |
T |
loadRecord(String identifier)
Load the data record identified from the storage system. |
private void |
loadRecord(T o,
ResultSet rs)
|
void |
refresh(T record)
Refreshes the record: Re-read the contents of the database into the given record. |
void |
removeRecord(T record)
|
void |
saveRecord(T record)
Save a record back to the storage system |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final String tableName
private final String idColumn
private final String nameColumn
Constructor Detail |
---|
protected SimpleDataEnumSQLLoader(String theTableName, String theIDColumnName, String theNameColumnName)
theTableName
- SQL table nametheIDColumnName
- integer ID column nametheNameColumnName
- the enumerated value's column nameMethod Detail |
---|
public void changed(T changedRecord)
RecordLoader
changed
in interface RecordLoader<T extends SimpleDataEnum<?>>
changedRecord
- the record that has been changedRecordLoader.changed(org.starhope.appius.util.DataRecord)
protected abstract Class<T> getRecordClass()
protected abstract Class<L> getRecordLoaderImplClass()
private T getRecordObject() throws NotFoundException
NotFoundException
- if the class can't be loaded or doesn't
havepublic String getSubversionRevision()
HasSubversionRevision
Return the Subversion revision level of this class's source code file, as supplied via the special "$Rev: " sequence.
As an example,the Subversion revision string for this file is "$Rev: 1968 $"
@Override public String getSubversionRevision () { return "$Rev: "; }
getSubversionRevision
in interface HasSubversionRevision
HasSubversionRevision.getSubversionRevision()
public void initializeStorage(String storageURL) throws NotReadyException
RecordLoader
initializeStorage
in interface RecordLoader<T extends SimpleDataEnum<?>>
storageURL
- A URL or identifier of the storage engine. The
syntax is specific to the RecordLoader implementation.
NotReadyException
- if the storage engine can't be
initialisedRecordLoader.initializeStorage(java.lang.String)
public boolean isRealtime()
isRealtime
in interface RecordLoader<T extends SimpleDataEnum<?>>
RecordLoader.isRealtime()
public T loadRecord(int id) throws NotFoundException
RecordLoader
loadRecord
in interface RecordLoader<T extends SimpleDataEnum<?>>
id
- the ID number for the record
NotFoundException
- if the record can't be loadedRecordLoader.loadRecord(int)
public T loadRecord(String identifier) throws NotFoundException
RecordLoader
loadRecord
in interface RecordLoader<T extends SimpleDataEnum<?>>
identifier
- the identifier for the record
NotFoundException
- if the record can't be loadedRecordLoader.loadRecord(java.lang.String)
private void loadRecord(T o, ResultSet rs) throws SQLException
o
- the record object to be loaded intors
- result set from a query
SQLException
- if there is a database record format errorpublic void refresh(T record)
RecordLoader
SimpleDataRecord.checkStale()
to try to reload data when
it might have been changed: it's trading elegance and efficiency
for expediency, but eventually, it should be removed.
refresh
in interface RecordLoader<T extends SimpleDataEnum<?>>
record
- the record to be reloaded.RecordLoader.refresh(org.starhope.appius.util.DataRecord)
public void removeRecord(T record)
removeRecord
in interface RecordLoader<T extends SimpleDataEnum<?>>
record
- Record to be deleted/removedRecordLoader.removeRecord(org.starhope.appius.util.DataRecord)
public void saveRecord(T record)
RecordLoader
saveRecord
in interface RecordLoader<T extends SimpleDataEnum<?>>
record
- the record to be savedRecordLoader.saveRecord(org.starhope.appius.util.DataRecord)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |