I am wondering if there is a way to apply @JsonProperty to an inherited fields of a class. For example I have the following classes.
public class Person {
protected String id;
protected String firstName;
protected String middleName;
protected String lastName;
}
...
/**
* need to figure out here, how to apply @JsonProperty
* to the fields below of the parent class:
* protected String id;
* protected String firstName;
* protected String middleName;
* protected String lastName;
*/
public class Employee extends Person {
@JsonProperty("DepartmentID")
protected String departmentId;
}
the goal here is that only Employee class will have @JsonProperty not the Person class.
Thanks.