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

Allow use of @JsonValue on Creator methods as alias to @JsonCreator(mode=DELEGATING) #3155

Closed
cowtowncoder opened this issue May 16, 2021 · 2 comments
Labels
duplicate Duplicate of an existing (usually earlier) issue

Comments

@cowtowncoder
Copy link
Member

It seems useful (if redundant) to allow use of @JsonValue as a sort of alias for existing @JsonCreator (with mode = DELEGATING). Doing this makes sense for the common case of @JsonValue already being used to indicate serialization, like:

public class StringBean {
    private String value;

    // Instead of this, allow @JsonValue
    @JsonCreator(mode = Mode.DELEGATING)
    public StringBean(String v) {
      value = v;
    }

    @JsonValue
    public String getValue() { return value; }
}

While this may be a minor thing for Java usage, this could be particularly helpful for Kotlin module.

@cowtowncoder cowtowncoder added to-evaluate Issue that has been received but not yet evaluated 2.13 and removed to-evaluate Issue that has been received but not yet evaluated labels May 16, 2021
@cowtowncoder cowtowncoder added 2.14 and removed 2.13 labels Jul 15, 2021
@yihtserns
Copy link
Contributor

Is this a duplicate of #3654?

@cowtowncoder
Copy link
Member Author

@yihtserns Well spotted! Yes it is. Closing.

@cowtowncoder cowtowncoder added duplicate Duplicate of an existing (usually earlier) issue and removed 2.14 labels May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Duplicate of an existing (usually earlier) issue
Projects
None yet
Development

No branches or pull requests

2 participants