strangedb/src/main/java/org/warp/cowdb/lists/ObjectCowList.java

40 lines
879 B
Java
Raw Normal View History

2019-02-01 00:04:51 +01:00
package org.warp.cowdb.lists;
2019-02-05 17:56:28 +01:00
import it.unimi.dsi.fastutil.longs.LongArrayList;
2019-02-01 00:04:51 +01:00
import org.warp.cowdb.EnhancedObject;
import org.warp.cowdb.IDatabase;
import org.warp.jcwdb.ann.DBDataType;
import org.warp.jcwdb.ann.DBField;
import java.io.IOException;
public class ObjectCowList<T> extends CowList<T> {
2019-02-05 17:56:28 +01:00
@DBField(id = 0, type = DBDataType.REFERENCES_LIST)
private LongArrayList indices;
@Override
protected LongArrayList getIndices() {
return indices;
}
2019-02-01 00:04:51 +01:00
public ObjectCowList() {
super();
}
public ObjectCowList(IDatabase database) throws IOException {
super(database);
2019-02-05 17:56:28 +01:00
indices = new LongArrayList();
}
2019-02-01 00:04:51 +01:00
@Override
protected T loadItem(long uid) throws IOException {
return database.getObjectsIO().loadObject(uid);
}
@Override
protected void writeItemToDisk(long uid, T item) throws IOException {
database.getObjectsIO().setObject(uid, item);
}
}