本文整理汇总了Java中io.paperdb.Paper.book方法的典型用法代码示例。如果您正苦于以下问题:Java Paper.book方法的具体用法?Java Paper.book怎么用?Java Paper.book使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.paperdb.Paper
的用法示例。
在下文中一共展示了Paper.book方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveValue
import io.paperdb.Paper; //导入方法依赖的package包/类
@Override
public void saveValue(String completePath, Object value) {
completePath = formatPath(completePath);
final Book book = Paper.book(VALUES);
if(value instanceof Integer) {
book.write(completePath, (Integer) value);
} else if(value instanceof Float) {
book.write(completePath, (Float) value);
} else if(value instanceof Boolean) {
book.write(completePath, (Boolean) value);
} else if(value instanceof Long) {
book.write(completePath, (Long) value);
} else {
book.write(completePath, String.valueOf(value));
}
}
示例2: remove
import io.paperdb.Paper; //导入方法依赖的package包/类
@Override
public void remove(String startingPath) {
final Book bookNodes = Paper.book(NODES);
final Book bookValues = Paper.book(VALUES);
final Set<String> nodes = getNodes();
final Set<String> nodesToKeep = new HashSet<>();
//update values
for (String node : nodes) {
if(node.startsWith(startingPath)) {
bookValues.delete(formatPath(node));
} else {
nodesToKeep.add(node);
}
}
bookNodes.write(NODES, nodesToKeep);
}
示例3: PaperDiskCache
import io.paperdb.Paper; //导入方法依赖的package包/类
public PaperDiskCache(@NonNull Context context, @NonNull Class<T> clazz, @NonNull SizePolicy sizePolicy) {
Paper.init(context);
this.cacheBook = Paper.book(clazz.getName());
this.cacheDirectory = new File(context.getFilesDir() + File.separator + clazz.getName());
this.sizePolicy = sizePolicy;
}
示例4: RxPaperBook
import io.paperdb.Paper; //导入方法依赖的package包/类
private RxPaperBook(Scheduler scheduler) {
this.scheduler = scheduler;
book = Paper.book();
}