rethinkdb / rethinkdb-java

Official RethinkDB Java client
https://rethinkdb.com/api/java/
Apache License 2.0
21 stars 10 forks source link

Use plain Jackson to get effectively the same deserialization results. #9

Closed NotJustAnna closed 4 years ago

NotJustAnna commented 4 years ago

Jackson has a built-in feature which makes this irrelevant. The plain ObjectMapper can be used if an DeserializationFeature is disabled.

NotJustAnna commented 4 years ago

Implemented a fix for #2 which is in the same method, so I appended it here.

srh commented 4 years ago

Does "effectively" the same deserialization results mean different results? If so, when?

NotJustAnna commented 4 years ago

Does "effectively" the same deserialization results mean different results? If so, when?

It should not generate different results, but this account for cases the previous method doesn't cover.

Example code:

public class User {
    private String name;
    private LoginToken loginToken;

    public LoginToken getLoginToken() { return loginToken; } // this is a getter
    public void setLoginToken(LoginToken loginToken) { this.loginToken = loginToken; } // this is a setter

    public static class LoginToken {
        private String b64;

        public String getB64() { return b64; }
        public void setB64(String b64) { this.b64 = b64; }
    }
}

Example serialized JSON:

{ name: "Adrian", loginToken: { b64: "SGkgSSdtIGFuIGVhc3RlciBlZ2ch", reset: 1581600000 } }

Example cases:

All previous code and serializations that already worked would keep working.