我正在为我的Android应用程序设计一个“高级过滤器”功能,我可以多选多个查询参数,具体取决于参数类型,它有时是一个联合,有时是一个交集,但总是在一个对象类型上(带有一些嵌套对象)。 有人会知道设计这样一个查询构建器的优雅和通用方法吗?
我的对象如下:
public class DBDocument扩展了RealmObject {
@PrimaryKey
private int _id;
private String updatedAt;
private String name;
private String subject;
private int type;
private int senderId;
private String dateSent;
private int paymentStatus;
private String paymentDue;
private double invoiceAmount;
private String currency;
private String acknowledged;
private String fetched;
private String exported;
private int recipient;
private int addressId;
private String printed;
private boolean important;
private boolean hidden;
private int printMode;
private int printRule;
private RealmList<DBTag> tag = new RealmList<>();
private RealmList<DBComment> comment = new RealmList<>();
private RealmList<DBEvent> event = new RealmList<>();
... }