private static Book getBook(String location, String name) {
if (mContext == null) {
throw new PaperDbException("Paper.init is not called");
}
String key = (location == null ? "" : location) + name;
synchronized (mBookMap) {
Book book = mBookMap.get(key);
if (book == null) {
if (location == null) {
book = new Book(mContext, name, mCustomSerializers);
} else {
// In this case, mContext is not used, so operation will succeed even if mContext == null
book = new Book(location, name, mCustomSerializers);
}
mBookMap.put(key, book);
}
return book;
}
}
the current
Paper.init(Context)forces you to provide a context. However there's a case where mContext in Paper is not used at all: when location is explicit in getBook().