PhoonOne February 2016

Is there a class level annotation for @JsonProperty

Is there a class level annotation for jackson's @JsonProperty ? Without knowing what field names are in the class, I can be able to annotate the class with a annotation and it will map it for me automatically?

Currently I have to annotate each field with a JsonProperty, is there something I can do at the class level that servers the same purpose?

public class myEntity() {

@JsonProperty("banner")
private String banner;

@JsonProperty("menu")
private String menu;

}

Answers


Michael Gantman February 2016

@JsonProperty is not class level annotation, and you don't need to mark your class with any annotation. If you provide your class name as an argument to parser it will know how to map it according to your getter methods. It is as if every getter method has been marked with @JsonProperty without any argument

Post Status

Asked in February 2016
Viewed 2,052 times
Voted 5
Answered 1 times

Search




Leave an answer