本文整理汇总了Java中com.couchbase.lite.Emitter.emit方法的典型用法代码示例。如果您正苦于以下问题:Java Emitter.emit方法的具体用法?Java Emitter.emit怎么用?Java Emitter.emit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.couchbase.lite.Emitter
的用法示例。
在下文中一共展示了Emitter.emit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTasksView
import com.couchbase.lite.Emitter; //导入方法依赖的package包/类
public View getTasksView() {
View view = mDatabase.getView("tasks");
if (view.getMap() == null) {
Mapper map = new Mapper() {
@Override
public void map(Map<String, Object> document, Emitter emitter) {
if ("task".equals(document.get("type"))) {
List<Object> keys = new ArrayList<Object>();
keys.add(document.get("list_id"));
keys.add(document.get("created_at"));
emitter.emit(keys, document);
}
}
};
view.setMap(map, "1.0");
}
return view;
}
示例2: test200SimpleNativeView
import com.couchbase.lite.Emitter; //导入方法依赖的package包/类
public void test200SimpleNativeView() {
MockEmiter nativeEmiter = new MockEmiter();
Map doc = new HashMap();
doc.put("_id", "foo");
Mapper nativeMap = new Mapper() {
@Override
public void map(Map<String, Object> document, Emitter emitter) {
emitter.emit(document.get("_id"), null);
}
};
for (int i = 0; i < 20000; i++) {
nativeMap.map(doc, nativeEmiter);
}
assertEquals(20000, nativeEmiter.count());
}
示例3: getListsView
import com.couchbase.lite.Emitter; //导入方法依赖的package包/类
/** Database View */
public View getListsView() {
View view = mDatabase.getView("lists");
if (view.getMap() == null) {
Mapper mapper = new Mapper() {
public void map(Map<String, Object> document, Emitter emitter) {
String type = (String)document.get("type");
if ("list".equals(type))
emitter.emit(document.get("title"), null);
}
};
view.setMap(mapper, "1.0");
}
return view;
}
示例4: getUserProfilesView
import com.couchbase.lite.Emitter; //导入方法依赖的package包/类
public View getUserProfilesView() {
View view = mDatabase.getView("profiles");
if (view.getMap() == null) {
Mapper map = new Mapper() {
@Override
public void map(Map<String, Object> document, Emitter emitter) {
if ("profile".equals(document.get("type")))
emitter.emit(document.get("name"), null);
}
};
view.setMap(map, "1.0");
}
return view;
}
示例5: map
import com.couchbase.lite.Emitter; //导入方法依赖的package包/类
@Override
public void map(Map<String, Object> document, Emitter emitter) {
String id = (String) document.get("_id");
String type = (String) document.get(CouchBaseStorage.DATA_TYPE);
if (!TextUtils.isEmpty(id) && TextUtils.equals(mType, type)) {
emitter.emit(id, null);
}
}