use of info.evelio.carbonite.cache.CacheOptions in project carbonite by eveliotc.
the class CacheFactoryImp method buildFromOpts.
@SuppressWarnings("unchecked")
private Cache<String, T> buildFromOpts(CacheBuilder builder) {
final CacheOptions opts = builder.opts();
if (opts == null) {
return null;
}
final Class<? extends Cache> type = opts.imp();
final Cache<String, T> instance = newCacheInstance(type, opts);
illegalState(!type.isInstance(instance), "Unable to instantiate cache, make sure it has a public constructor with proper options type.");
return instance;
}
Aggregations