Package org.jboss.weld.util.cache
Class LoadingCacheUtils
- java.lang.Object
-
- org.jboss.weld.util.cache.LoadingCacheUtils
-
public final class LoadingCacheUtils extends Object
Guava loading cache utilities.- Author:
- Martin Kouba
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V>
VgetCacheValue(com.google.common.cache.LoadingCache<K,V> cache, K key)Get the cache value for the given key.static <T,K,V>
TgetCastCacheValue(com.google.common.cache.LoadingCache<K,V> cache, Object key)Get and cast the cache value for the given key.
-
-
-
Method Detail
-
getCacheValue
public static <K,V> V getCacheValue(com.google.common.cache.LoadingCache<K,V> cache, K key)Get the cache value for the given key.- Type Parameters:
K- Key typeV- Value type- Parameters:
cache-key-- Returns:
- the cache value
- Throws:
com.google.common.util.concurrent.ExecutionError- if an error is thrown while loading the value
-
getCastCacheValue
public static <T,K,V> T getCastCacheValue(com.google.common.cache.LoadingCache<K,V> cache, Object key)Get and cast the cache value for the given key.- Type Parameters:
T- Required typeK- Key typeV- Value type- Parameters:
cache-key-- Returns:
- the cache value cast to the required type
- Throws:
com.google.common.util.concurrent.ExecutionError- if an error is thrown while loading the value
-
-