【发布时间】:2017-08-18 08:47:16
【问题描述】:
我正在使用 Couchbase lite 开发一个 Android 应用程序。
我应该让我的课程扩展com.couchbase.lite.Document 吗?
优点:DAO 集成在类中。
缺点: - 每个对象都链接到一个文档,如果我们想要一个新对象,我们必须在 couchbase 中创建一个新文档? - 还有什么?
例如:
public class UserProfile extends Document {
public UserProfile (Database database, String documentId);
public Map<String, Object> getProperties();
public boolean isModified();
public boolean update() throws CouchbaseLiteException {
if (isModified()) {
super.putProperties(getProperties());
return true;
}
else
return false;
}
}
【问题讨论】:
标签: android design-patterns dao couchbase-lite