Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more common serializers #138

Open
sanastas opened this issue Mar 1, 2021 · 2 comments
Open

Add more common serializers #138

sanastas opened this issue Mar 1, 2021 · 2 comments

Comments

@sanastas
Copy link
Contributor

sanastas commented Mar 1, 2021

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.

@nnrepos
Copy link
Contributor

nnrepos commented Mar 15, 2021

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);
    }

@liran-funaro
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants