]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ValueQueryFactory.java
DB query swapping to file system
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / query / ValueQueryFactory.java
diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ValueQueryFactory.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/ValueQueryFactory.java
new file mode 100644 (file)
index 0000000..4a746fd
--- /dev/null
@@ -0,0 +1,21 @@
+package org.simantics.db.impl.query;
+
+import org.simantics.db.exception.DatabaseException;
+
+public class ValueQueryFactory extends QueryFactoryBase {
+
+    @Override
+    public CacheEntryBase readKeyAndValue(QueryDeserializer deserializer) throws DatabaseException {
+        ValueQuery result = reference(deserializer);
+        byte[] bytes = deserializer.readByteArray();
+        result.setResult(bytes);
+        result.setReady();
+        return result;
+    }
+    
+    @Override
+    public <T extends CacheEntryBase> T reference(QueryDeserializer deserializer) throws DatabaseException {
+        return (T)deserializer.readValueQuery();
+    }
+
+}