I've a Classified interface, annotated with @JsonAutoDetect with Visibility.NONE, so I can pick individual getters to be serialized with the @JsonSerialize annotation
@JsonAutoDetect(getterVisibility = Visibility.NONE)
public interface Classified {
@JsonSerialize
String getModel();
Until here there is no problem, and when I return Classified with @ResponseBody annotation, from my @Controller, it works returning the expected JSON:
@RequestMapping(value = "/classified/{idClassified}", method = RequestMethod.GET)
@ResponseBody
public final Classified getClassified(@PathVariable final int idClassified) {
However when I return a List of Classifieds, I would like to return a smaller set of getters, while with the following signature, obviously it returns all marked getters:
@RequestMapping(value = "/classified", method = RequestMethod.GET)
@ResponseBody
public final List<Classified> searchClassified(@RequestParam final int idBrand,
@RequestParam final String priceMax, @RequestParam final int page) {
I don't know how to return a smaller subset of Classified getters in each item of the list.