how can I keep all the nested objects with the same property names?
for example. Top level class is Policy.
@JsonFilter("myFilter")
public class Policy {
String name;
String number;
List<Participant> participants;
List<Asset> assets;
Map<String, String> additionalFields;
}
@JsonFilter("myFilter")
public class Participant {
String name;
String number;
List<Asset> assets;
Map<String, String> additionalFields;
}
@JsonFilter("myFilter")
public class Asset {
String name;
String number;
Map<String, String> additionalFields;
}
now, I want to exclude all fields except additionalFields on all the objects in response. I have the below implementation, but this removes everything and only keep additionalFields on Policy.
SimpleFilterProvider filterProvider = new SimpleFilterProvider() .addFilter("myFilter", SimpleBeanPropertyFilter.filterOutAllExcept("additionalFields"));