Skip to content

Conversation

@NotJustAnna
Copy link
Member

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

@NotJustAnna
Copy link
Member Author

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

@srh
Copy link
Contributor

srh commented Feb 12, 2020

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

@NotJustAnna
Copy link
Member Author

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:

  • If there's an private field (name) but not a public setter for a property, previous code wouldn't find this case and JacksonXML would fail.
  • If there's a field missing on a child class (loginToken -> reset), previous code wouldn't find this case and JacksonXML would fail.

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

@NotJustAnna NotJustAnna linked an issue Feb 13, 2020 that may be closed by this pull request
@NotJustAnna NotJustAnna merged commit 4f6ee3b into master Feb 14, 2020
@gabor-boros gabor-boros deleted the fix/use-plain-jackson branch February 14, 2020 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enum serialization/deserialization support

4 participants