这是创建Realm架构的正确方法吗?
public class Merchandise extends RealmObject {
private long id;
private String name;
}
public class Cluster extends RealmObject {
private String name;
}
Cluster assortment = new Cluster;
assortment.setName("Assortment");
assortment.setList(new RealmList<Cluster> assortment_list);
// there are "meat", "poultry", "milk_products" etc. in this RL
Cluster milk_products = new Cluster;
milk_products.setName("Milk products");
milk_products.setList(new RealmList<Cluster> milk_products_list);
// there are "cottage_cheeses", "milk_desserts" etc. in this RL
Cluster milk_desserts = new Cluster;
milk_desserts.setName("Milk desserts");
milk_desserts.setList(new RealmList<Cluster> milk_desserts_list);
// there are "cottage_cheese_casseroles", "panna_cottas" etc. in this RL
Cluster panna_cottas = new Cluster;
panna_cottas.setName("Panna-cotta");
panna_cottas.setList(new RealmList<Merchandise> panna_cottas_list);
// various kinds of panna-cotta in this RL
MerchandiseRecyclerView
(此处为主要数据)和ClusterRecyclerView
(用于过滤在MRV中显示数据)。
我想在查询Realm for&#34; assortment_list&#34;时显示MRV中的所有Merchandise对象,例如,仅显示来自牛奶的产品查询&#34; milk_products_list&#34;。
这种递归关系会起作用吗?