I have the following JsonView
configuration:
public class JsonViews {
public static class AdminView {
}
public static class PublicView extends AdminView {
}
}
I have the following entity:
public class UserEntity {
@JsonView(JsonViews.AdminView.class)
private int id;
@JsonView(JsonViews.PublicView.class)
private int name;
// getters / setters
}
In my controller I have the following methods:
I want this method to return ALL properties
@JsonView(JsonViews.AdminView.class) public List<User> getAllOnlyForAdmin { return foo; }
I want this to return ONLY the name property
@JsonView(JsonViews.PublicView.class) public List<User> getAllOnlyForAdmin { return foo; }
Possible? If not, is there another solution?