我已经读过this article,该书描述了杰克逊过滤并搜查了互联网,但无法确定一种基于另一个字段过滤一个字段的方法。
假设我有这个课程:
public class Address {
private int zip;
private String city;
private String streetAddress;
private String state;
}
我将如何设置一个序列化过滤器,以便无论何时邮政编码以9开头,状态都被排除在外?我需要使用SimpleBeanPropertyFilter
。
例如:
Address(90000, "Prunedale", "123 Localhost", "Vermont")
// {"zip": 90000, "city": "Prunedale", "streetAddress": "123 Localhost"}
Address(80000, "Prunedale", "123 Localhost", "Vermont")
// {"zip": 80000, "city": "Prunedale", "streetAddress": "123 Localhost", "state": "Vermont"}
感谢您的帮助!