java Android领域子类实例方法
我已经读了很多关于Realm的书,它似乎是一个非常简洁的工具,我很想尝试一下;然而,我在几个不同的地方读到,Android版本不支持RealmObject子类的非静态方法
这在their documentation中并不完全清楚。这意味着不支持非静态方法,但在它们的FAQ部分,在下,为什么我需要为所有字段设置getter和setter,它们使用公共的、非静态的方法
此外,它在this文章中明确指出:
You will get compilation errors for using ANY other methods in the model class. Think about this for a moment ...
Yeah.. you can not have toString(), Static methods, not even other behavior methods in your model classes.
所以我有点困惑。我明白我不能有定制的getter/setter;我不喜欢,但这不是一个交易破坏者。但不能拥有任何非静态实例方法则是另一回事
那是哪一个呢?我的RealmObject子类中是否可以有非静态实例方法
谢谢
# 1 楼答案
你是对的,你不能有自定义的getter和setter
允许的内容:
什么是不允许的:
equals()
上覆盖toString()
但是they are working on it
明确地说,RTFM:
Source