39 lines
904 B
Java
39 lines
904 B
Java
package org.warp.jcwdb.lists;
|
|
|
|
import it.unimi.dsi.fastutil.longs.LongArrayList;
|
|
import org.warp.jcwdb.database.IDatabaseTools;
|
|
import org.warp.jcwdb.annotations.DBDataType;
|
|
import org.warp.jcwdb.annotations.DBField;
|
|
|
|
import java.io.IOException;
|
|
|
|
public class ObjectJCWDBList<T> extends JCWDBList<T> {
|
|
|
|
@DBField(id = 0, type = DBDataType.REFERENCES_LIST)
|
|
private LongArrayList indices;
|
|
|
|
@Override
|
|
protected LongArrayList getIndices() {
|
|
return indices;
|
|
}
|
|
|
|
public ObjectJCWDBList() {
|
|
super();
|
|
}
|
|
|
|
public ObjectJCWDBList(IDatabaseTools databaseTools) throws IOException {
|
|
super(databaseTools);
|
|
indices = new LongArrayList();
|
|
}
|
|
|
|
@Override
|
|
protected T loadItem(long uid) throws IOException {
|
|
return databaseTools.getObjectsIO().loadObject(uid);
|
|
}
|
|
|
|
@Override
|
|
protected void writeItemToDisk(long uid, T item) throws IOException {
|
|
databaseTools.getObjectsIO().setObject(uid, item);
|
|
}
|
|
}
|