strangedb/src/main/java/org/warp/jcwdb/ann/DBDBObjectList.java

29 lines
668 B
Java

package org.warp.jcwdb.ann;
import java.io.IOException;
public class DBDBObjectList<T extends DBObject> extends DBArrayList<T> {
@DBField(id = 1, type = DBDataType.OBJECT)
private Class<T> type;
public DBDBObjectList() {
super();
}
public DBDBObjectList(JCWDatabase database, Class<T> type) throws IOException {
super(database);
this.type = type;
}
@Override
protected T loadItem(long uid) throws IOException {
return database.getDataLoader().loadDBObject(type, uid);
}
@Override
protected void writeItemToDisk(long uid, T item) throws IOException {
database.getDataLoader().writeObjectProperty(uid, DBDataType.DATABASE_OBJECT, item);
}
}