com.chutneytesting.tools.FunctionCacheLoader Maven / Gradle / Ivy
package com.chutneytesting.tools;
import com.google.common.cache.CacheLoader;
import java.util.function.Function;
/**
* Bridge between {@link Function} and {@link CacheLoader}.
* {@link CacheLoader} has the same erasure as {@link Function}, but as an abstract class it cannot be created without initialization (constructor).
*/
class FunctionCacheLoader extends CacheLoader {
private final Function loader;
FunctionCacheLoader(Function loader) {
this.loader = loader;
}
@Override
public V load(K key) throws Exception {
return loader.apply(key);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy