Package javax.cache.event
Class CacheEntryEvent<K,V>
- java.lang.Object
-
- java.util.EventObject
-
- javax.cache.event.CacheEntryEvent<K,V>
-
- Type Parameters:
K
- the type of keyV
- the type of value
- All Implemented Interfaces:
java.io.Serializable
,Cache.Entry<K,V>
public abstract class CacheEntryEvent<K,V> extends java.util.EventObject implements Cache.Entry<K,V>
A Cache entry event base class.- Since:
- 1.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CacheEntryEvent(Cache source, EventType eventType)
Constructs a cache entry event from a given cache as source
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description EventType
getEventType()
Gets the event type of this eventabstract V
getOldValue()
Returns the previous value that existed for entry in the cache before modification or removal.Cache
getSource()
abstract V
getValue()
Returns the value stored in the cache when this entry was created or updated.abstract boolean
isOldValueAvailable()
Whether the old value is available.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.cache.Cache.Entry
getKey, unwrap
-
-
-
-
Field Detail
-
eventType
private EventType eventType
-
-
Method Detail
-
getSource
public final Cache getSource()
- Overrides:
getSource
in classjava.util.EventObject
-
getValue
public abstract V getValue()
Returns the value stored in the cache when this entry was created or updated.The value will be available for
CacheEntryCreatedListener
andCacheEntryUpdatedListener
. Returns the same value asgetOldValue()
forCacheEntryExpiredListener
andCacheEntryRemovedListener
. Cache clients that need to maintain compatibility with JSR107 version 1.0 cache implementations, need to use this method for retrieving the expired or removed value. When using cache implementations compatible with JSR107 version 1.1, clients should prefer the methodgetOldValue()
.- Specified by:
getValue
in interfaceCache.Entry<K,V>
- Returns:
- the value corresponding to this entry
- See Also:
getOldValue()
-
getOldValue
public abstract V getOldValue()
Returns the previous value that existed for entry in the cache before modification or removal. The old value will be available forCacheEntryUpdatedListener
,CacheEntryExpiredListener
andCacheEntryRemovedListener
ifCacheEntryListenerConfiguration.isOldValueRequired()
is true. The old value may be available forCacheEntryUpdatedListener
,CacheEntryExpiredListener
andCacheEntryRemovedListener
ifCacheEntryListenerConfiguration.isOldValueRequired()
is false.- Returns:
- the previous value or
null
if there was no previous value or the previous value is not available
-
isOldValueAvailable
public abstract boolean isOldValueAvailable()
Whether the old value is available. The old value will be available forCacheEntryUpdatedListener
,CacheEntryExpiredListener
andCacheEntryRemovedListener
ifCacheEntryListenerConfiguration.isOldValueRequired()
is true. The old value may be available forCacheEntryUpdatedListener
,CacheEntryExpiredListener
andCacheEntryRemovedListener
ifCacheEntryListenerConfiguration.isOldValueRequired()
is false.- Returns:
- true if the old value is definitely available
-
getEventType
public final EventType getEventType()
Gets the event type of this event- Returns:
- the event type.
-
-