public class TransformingCacheProxy<K,V,K0,V0> extends Object implements javax.cache.Cache<K,V>
This generic approach also may convert the types. Right now we just need the identical types, so this might be a little over engineered.
Complete except listeners and configuration.
| Modifier and Type | Field and Description |
|---|---|
protected javax.cache.Cache<K0,V0> |
cache |
protected ObjectTransformer<K,K0> |
keyTransformer |
protected ObjectTransformer<K,K0> |
passingKeyTransformer |
protected ObjectTransformer<V,V0> |
passingValueTransformer |
protected ObjectTransformer<V,V0> |
valueTransformer |
| Constructor and Description |
|---|
TransformingCacheProxy(javax.cache.Cache<K0,V0> cache,
ObjectTransformer<K,K0> keyTransformer,
ObjectTransformer<V,V0> valueTransformer,
ObjectTransformer<K,K0> passingKeyTransformer,
ObjectTransformer<V,V0> passingValueTransformer) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
void |
close() |
boolean |
containsKey(K key) |
void |
deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
Not supported (yet?)
|
V |
get(K key) |
Map<K,V> |
getAll(Set<? extends K> keys) |
V |
getAndPut(K key,
V value) |
V |
getAndRemove(K key) |
V |
getAndReplace(K key,
V value) |
javax.cache.CacheManager |
getCacheManager() |
<C extends javax.cache.configuration.Configuration<K,V>> |
getConfiguration(Class<C> clazz)
Not supported (yet?)
|
String |
getName() |
javax.cache.Cache<K0,V0> |
getWrappedCache() |
<T> T |
invoke(K key,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... arguments) |
<T> Map<K,javax.cache.processor.EntryProcessorResult<T>> |
invokeAll(Set<? extends K> keys,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... arguments) |
boolean |
isClosed() |
Iterator<javax.cache.Cache.Entry<K,V>> |
iterator() |
void |
loadAll(Set<? extends K> keys,
boolean replaceExistingValues,
javax.cache.integration.CompletionListener completionListener) |
void |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> map) |
boolean |
putIfAbsent(K key,
V value) |
void |
registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
Not supported (yet?)
|
boolean |
remove(K key) |
boolean |
remove(K key,
V oldValue) |
void |
removeAll() |
void |
removeAll(Set<? extends K> keys) |
boolean |
replace(K key,
V value) |
boolean |
replace(K key,
V oldValue,
V newValue) |
String |
toString() |
<T> T |
unwrap(Class<T> clazz) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorprotected ObjectTransformer<K,K0> keyTransformer
protected ObjectTransformer<V,V0> valueTransformer
protected ObjectTransformer<K,K0> passingKeyTransformer
protected ObjectTransformer<V,V0> passingValueTransformer
public TransformingCacheProxy(javax.cache.Cache<K0,V0> cache, ObjectTransformer<K,K0> keyTransformer, ObjectTransformer<V,V0> valueTransformer, ObjectTransformer<K,K0> passingKeyTransformer, ObjectTransformer<V,V0> passingValueTransformer)
cache - the wrapped cachekeyTransformer - Keys that go in and out will be sent throughvalueTransformer - Values that go in and out will be sent throughpassingKeyTransformer - Special transformer for keys that go in and are not stored by
the cache (e.g. for #conatainsKey)passingValueTransformer - Special transformer for keys that go in and are not stored by
the cache (e.g. for the oldValue in replace)public boolean containsKey(K key)
public void loadAll(Set<? extends K> keys, boolean replaceExistingValues, javax.cache.integration.CompletionListener completionListener)
public <C extends javax.cache.configuration.Configuration<K,V>> C getConfiguration(Class<C> clazz)
getConfiguration in interface javax.cache.Cache<K,V>UnsupportedOperationException - always throws exceptionpublic <T> T invoke(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... arguments) throws javax.cache.processor.EntryProcessorException
public <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... arguments)
public javax.cache.CacheManager getCacheManager()
public void close()
public void registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
registerCacheEntryListener in interface javax.cache.Cache<K,V>UnsupportedOperationException - always throws exceptionpublic void deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
deregisterCacheEntryListener in interface javax.cache.Cache<K,V>UnsupportedOperationException - always throws exceptioncache2k API documentation. Copyright © 2000–2020 headissue GmbH, Munich.