[英]Android RealmList<Integer> and RealmList<String>
I'm working with Realm to create my android app's ORM with Realm. 我正在与Realm合作,用Realm创建我的Android应用程序的ORM。 The problem is that when I try to create an object like this:
问题是,当我尝试创建这样的对象时:
public class Airport extends RealmObject {
private int Id;
private String Name;
private String Code;
private RealmList<Integer> destinations;
}
androidStudio tells me that I can't have the RealmList with type Integer; androidStudio告诉我,我不能拥有类型为Integer的RealmList; and for String type either.
并且对于String类型也是。 I've been looking a few similar questions, but the best approach is to declare an object like:
我一直在寻找一些类似的问题,但最好的方法是声明一个像这样的对象:
public class MyRealmInteger extends RealmObject {
private int destination;
}
so this way I can rewrite my class as follows: 所以这样我可以按如下方式重写我的课程:
public class Airport extends RealmObject {
private int Id;
private String Name;
private String Code;
private RealmList<MyRealmInteger> destinations;
}
but I think it's a very complicated. 但我觉得这很复杂。 There isn't any other easier solution?
没有其他更简单的解决方案?
but I think it's a very complicated.
但我觉得这很复杂。 There isn't any other easier solution?
没有其他更简单的解决方案?
No there is not. 不,那里没有。 Not yet at least.
至少还没有。 They're "working on it":
他们正在“努力”:
This feature is among a handfull of top features that we hope to take on next.
此功能是我们希望接下来要处理的一些主要功能之一。 We will however give the current 1.0 a bit of peace to ensure stability before we push a lot of new features.
然而,在我们推出许多新功能之前,我们将给予当前1.0一点和平以确保稳定性。
You can check this issue for updates on it https://github.com/realm/realm-java/issues/575 您可以查看此问题以获取更新信息https://github.com/realm/realm-java/issues/575
请看一下这个答案https://stackoverflow.com/a/46576569/3479489领域将在4.0.0版本中添加对原语的支持
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.