Add more common serializers
Oak requests its users to provide serializers for their objects representing keys and values.
Oak has internal common package including sub-packages for common serializers for common objects: IntBuffer, Integer and String. It would be good to have more of such. What kind of objects? It is up to implementer decision.
@liran-funaro can you please add more details to this issue?
For more explanations feel free to add questions in this issue.
how would a FloatSerializer be different from an IntSerializer?
wouldn't this suffice:
public class OakFloatSerializer implements OakSerializer<Float> {
private final int size;
public OakFloatSerializer() {
this(Float.BYTES);
}
public OakFloatSerializer(int size) {
this.size = size;
}
@Override
public void serialize(Float value, OakScopedWriteBuffer targetBuffer) {
targetBuffer.putFloat(0, value);
}
Yes. That is exactly what we expect. It would also help if a simple test would be added that validates that this serializer works correctly with OakMap.