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

Improve Serializer #33

Closed
alalag1 opened this issue Feb 20, 2021 · 0 comments · Fixed by #86
Closed

Improve Serializer #33

alalag1 opened this issue Feb 20, 2021 · 0 comments · Fixed by #86
Assignees
Labels
refactor Code change

Comments

@alalag1
Copy link
Member

alalag1 commented Feb 20, 2021

Motivation

Interface spec of HttpBodySerializer

    @Override
    default boolean supportsRead(MediaType mediaType, Type type) {
        return true;
    }

    @Override
    default boolean supportsWrite(MediaType mediaType, Type type) {
        return true;
    }

    byte[] serialize(Object target) throws Exception;

    <T> T deSerialize(byte[] data, Type type) throws Exception;

Problem is that the end-user do not know how to serialize/deserialize after calling supportsRead(MediaType mediaType, Type type) because parameters of MediaType and Type is not passed in serialize() and deSerialize()

Improvement

  1. Pass MediaType and Type in serialize() and deSerialize()
    It is easy to do this, but the end-user may need to do the parameters check twice, which is not good for performance.
  2. Remove supportsRead() and supportsWrite()
    This would be good for performance but it would be hard to design the serialize() and deSerialize().
@alalag1 alalag1 added the refactor Code change label Feb 20, 2021
@alalag1 alalag1 added this to To Do in Full JAX-RS support via automation Feb 20, 2021
@Mkabaka Mkabaka self-assigned this Jan 24, 2022
@Mkabaka Mkabaka linked a pull request Jan 24, 2022 that will close this issue
@Mkabaka Mkabaka closed this as completed Jan 24, 2022
Full JAX-RS support automation moved this from To Do to Done Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Code change
Projects
Development

Successfully merging a pull request may close this issue.

2 participants