Created
September 16, 2017 00:29
-
-
Save liviutudor/783f3c6d3e4e1532a3cfff09327ff5f7 to your computer and use it in GitHub Desktop.
Usage of Jackson annotations when removing setters and zero-args constructor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.fasterxml.jackson.annotation.JsonCreator; | |
import com.fasterxml.jackson.annotation.JsonProperty; | |
public class JacksonBean { | |
private final int value; | |
private final String another; | |
@JsonCreator | |
public JacksonBean(@JsonProperty("value") int value, @JsonProperty("another") String another) { | |
this.value = value; | |
this.another = another; | |
} | |
public int getValue() { | |
return value; | |
} | |
public String getAnother() { | |
return another; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment