Getting Started with the Jackson JSON Processor — Citrine Informatics
What if you don't want your class to follow the JavaBean conventions? For example, you may want to create an immutable class - one without any setters. For those situations we can use the @JsonCreator annotation to declare a method that Jackson uses to create new instances of our class. The example below uses a constructor as the JsonCreator method. Note that you must annotate each argument of the constructor with @JsonProperty and give the name of the JSON field that should be used for that argument.
Read full article from Getting Started with the Jackson JSON Processor — Citrine Informatics
No comments:
Post a Comment