36 lines
903 B
Java
36 lines
903 B
Java
package org.warp.jcwdb.ann;
|
|
|
|
import java.io.IOException;
|
|
import java.util.LinkedList;
|
|
|
|
public class DBDBObjectList<T extends DBObject> extends DBList<T> {
|
|
|
|
@DBField(id = 2, type = DBDataType.OBJECT)
|
|
public Class<T> type;
|
|
|
|
public DBDBObjectList(JCWDatabase db, Class<T> type) {
|
|
super(db, 10);
|
|
this.type = type;
|
|
}
|
|
|
|
public DBDBObjectList(JCWDatabase db, Class<T> type, int maxLoadedItems) {
|
|
super(db, maxLoadedItems);
|
|
this.type = type;
|
|
}
|
|
|
|
public DBDBObjectList(JCWDatabase database, DBObjectIndicesManager.DBObjectInfo objectInfo) throws IOException {
|
|
super(database, objectInfo);
|
|
}
|
|
|
|
@Override
|
|
protected T loadObjectFromDatabase(long uid) throws IOException {
|
|
return database.loadDBObject(type, uid);
|
|
}
|
|
|
|
@Override
|
|
protected long saveObjectToDatabase(long uid, T value) throws IOException {
|
|
database.writeObjectProperty(uid, DBDataType.DATABASE_OBJECT, value);
|
|
return uid;
|
|
}
|
|
}
|