本文整理汇总了Java中com.octo.android.robospice.persistence.exception.CacheCreationException类的典型用法代码示例。如果您正苦于以下问题:Java CacheCreationException类的具体用法?Java CacheCreationException怎么用?Java CacheCreationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CacheCreationException类属于com.octo.android.robospice.persistence.exception包,在下文中一共展示了CacheCreationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCacheManager
import com.octo.android.robospice.persistence.exception.CacheCreationException; //导入依赖的package包/类
@Override
public CacheManager createCacheManager(Application app) throws CacheCreationException {
LruCache<String, Templates> templatesCache = new LruCache<>(DEFAULT_CACHE_SIZE);
LruCache<String, Lists> listsCache = new LruCache<>(DEFAULT_CACHE_SIZE);
LruCacheObjectPersister templatesPersister;
LruCacheObjectPersister listsPersister;
templatesPersister = new LruCacheObjectPersister(Templates.class, templatesCache);
listsPersister = new LruCacheObjectPersister(Lists.class, listsCache);
CacheManager cacheManager = new CacheManager();
cacheManager.addPersister(templatesPersister);
cacheManager.addPersister(listsPersister);
return cacheManager;
}
示例2: createCacheManager
import com.octo.android.robospice.persistence.exception.CacheCreationException; //导入依赖的package包/类
@Override
public CacheManager createCacheManager(Application application) throws CacheCreationException {
CacheManager cacheManager = new CacheManager();
cachePersister = new RetrofitObjectPersisterFactory(application, getConverter());
cacheManager.addPersister(cachePersister);
return cacheManager;
}
示例3: createCacheManager
import com.octo.android.robospice.persistence.exception.CacheCreationException; //导入依赖的package包/类
@Override
public CacheManager createCacheManager(Application application) throws CacheCreationException {
return new CacheManager() {
@Override
public <T> T saveDataToCacheAndReturnData(T data, Object cacheKey) throws CacheSavingException, CacheCreationException {
return data;
}
};
}
示例4: createCacheManager
import com.octo.android.robospice.persistence.exception.CacheCreationException; //导入依赖的package包/类
@Override
public CacheManager createCacheManager(Application application) throws CacheCreationException {
CacheManager cacheManager = new CacheManager();
// TODO: This should be injected via dagger
cacheManager.addPersister(new FileJsonCacheFactory(application).create());
return cacheManager;
}
示例5: createCacheManager
import com.octo.android.robospice.persistence.exception.CacheCreationException; //导入依赖的package包/类
@Override
public CacheManager createCacheManager(Application application) throws CacheCreationException {
CacheManager cachemanager = new CacheManager();
for (Iterator iterator = mExtensionMap.values().iterator(); iterator.hasNext(); ((Extension) iterator
.next()).onCacheManager(application, cachemanager)) {}
return cachemanager;
}
示例6: createGeneFavoritesPersister
import com.octo.android.robospice.persistence.exception.CacheCreationException; //导入依赖的package包/类
private LruCacheObjectPersister<Gene> createGeneFavoritesPersister() {
LruCache<Object, CacheItem<Gene>> geneCache = new LruCache<>(DEFAULT_GENE_FAVORITES_CACHE_SIZE);
try {
InFileObjectPersister<Gene> inFilePersister = new GsonObjectPersister((Application) mContext, Gene.class);
LruCacheObjectPersister<Gene> persister = new LruCacheObjectPersister<>(inFilePersister, geneCache);
persister.setAsyncSaveEnabled(true);
return persister;
} catch (CacheCreationException e) {
Log.e(TAG, "Failed to create gene favorites persister!", e);
}
return null;
}
示例7: createCacheManager
import com.octo.android.robospice.persistence.exception.CacheCreationException; //导入依赖的package包/类
@Override
public CacheManager createCacheManager(Application application) throws CacheCreationException {
CacheManager cacheManager = new CacheManager();
OrmLiteUriMatcher matcher = OrmLiteUriMatcher.getInstance(DefaultUriMatcher.class, DefaultContract.CONTENT_AUTHORITY);
// init
RoboSpiceDatabaseHelper databaseHelper = new RoboSpiceDatabaseHelper(application, DefaultDatabaseHelper.DATABASE_NAME, DefaultDatabaseHelper.DATABASE_VERSION);
InDatabaseObjectPersisterFactory inDatabaseObjectPersisterFactory = new InDatabaseObjectPersisterFactory( application, databaseHelper, matcher.getClassToNotificationUriMap() );
cacheManager.addPersister(inDatabaseObjectPersisterFactory);
return cacheManager;
}
示例8: createCacheManager
import com.octo.android.robospice.persistence.exception.CacheCreationException; //导入依赖的package包/类
@Override
public CacheManager createCacheManager(Application application) throws CacheCreationException {
CacheManager cacheManager = new CacheManager();
TestUriMatcher matcher = SQLiteUriMatcher.getInstance(TestUriMatcher.class, TestContract.CONTENT_AUTHORITY);
// init
RoboSpiceDatabaseHelper databaseHelper = new RoboSpiceDatabaseHelper(application, TestDatabaseHelper.DATABASE_NAME, TestDatabaseHelper.DATABASE_VERSION);
InDatabaseObjectPersisterFactory inDatabaseObjectPersisterFactory = new InDatabaseObjectPersisterFactory( application, databaseHelper, matcher.getClassToNotificationUriMap() );
cacheManager.addPersister(inDatabaseObjectPersisterFactory);
return cacheManager;
}
示例9: createCacheManager
import com.octo.android.robospice.persistence.exception.CacheCreationException; //导入依赖的package包/类
@Override
public CacheManager createCacheManager(Application application) {
CacheManager cacheManager = new CacheManager();
JacksonObjectPersisterFactory jacksonObjectPersisterFactory;
try {
jacksonObjectPersisterFactory = new JacksonObjectPersisterFactory(application);
cacheManager.addPersister(jacksonObjectPersisterFactory);
} catch (CacheCreationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return cacheManager;
}
示例10: createCacheManager
import com.octo.android.robospice.persistence.exception.CacheCreationException; //导入依赖的package包/类
@Override
public CacheManager createCacheManager( Application application ) {
CacheManager cacheManager = new CacheManager();
// init
InFileStringObjectPersister inFileStringObjectPersister;
InFileInputStreamObjectPersister inFileInputStreamObjectPersister;
Jackson2ObjectPersisterFactory inJSonFileObjectPersisterFactory;
try {
inFileStringObjectPersister = new InFileStringObjectPersister(application);
inFileInputStreamObjectPersister = new InFileInputStreamObjectPersister(application);
inJSonFileObjectPersisterFactory = new Jackson2ObjectPersisterFactory(application);
} catch (CacheCreationException e) {
e.printStackTrace();
return null;
}
inFileStringObjectPersister.setAsyncSaveEnabled( true );
inFileInputStreamObjectPersister.setAsyncSaveEnabled( true );
inJSonFileObjectPersisterFactory.setAsyncSaveEnabled( true );
cacheManager.addPersister( inFileStringObjectPersister );
cacheManager.addPersister( inFileInputStreamObjectPersister );
cacheManager.addPersister( inJSonFileObjectPersisterFactory );
return cacheManager;
}
示例11: RetrofitObjectPersister
import com.octo.android.robospice.persistence.exception.CacheCreationException; //导入依赖的package包/类
public RetrofitObjectPersister(Application application, Converter.Factory converter, Class<T> clazz, File cacheFolder, Retrofit retrofit) throws CacheCreationException {
super(application, clazz, cacheFolder);
this.converter = converter;
this.retrofit = retrofit;
}
示例12: RetrofitObjectPersisterFactory
import com.octo.android.robospice.persistence.exception.CacheCreationException; //导入依赖的package包/类
public RetrofitObjectPersisterFactory(Application application, Converter.Factory converter) throws CacheCreationException {
super(application);
this.converter = converter;
}
示例13: createInFileObjectPersister
import com.octo.android.robospice.persistence.exception.CacheCreationException; //导入依赖的package包/类
@Override
public <DATA> InFileObjectPersister<DATA> createInFileObjectPersister(Class<DATA> clazz, File cacheFolder) throws CacheCreationException {
return new RetrofitObjectPersister<DATA>(getApplication(), converter, clazz, cacheFolder, retrofit);
}
示例14: createCacheManager
import com.octo.android.robospice.persistence.exception.CacheCreationException; //导入依赖的package包/类
@Override
public CacheManager createCacheManager(Application application) throws CacheCreationException {
return new CacheManager();
}
示例15: create
import com.octo.android.robospice.persistence.exception.CacheCreationException; //导入依赖的package包/类
public FileJsonCache create() throws CacheCreationException {
return new FileJsonCache(application, JsonObject.class, new File(application.getCacheDir(), "json"));
}