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:
Serializable, Cache.Entry<K,V>
A Cache entry event base class.
- Since:
- 1.0
- See Also:
-
Field Summary
FieldsFields inherited from class EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionCacheEntryEvent(Cache source, EventType eventType) Constructs a cache entry event from a given cache as source -
Method Summary
Modifier and TypeMethodDescriptionfinal EventTypeGets the event type of this eventabstract VReturns the previous value that existed for entry in the cache before modification or removal.final Cacheabstract VgetValue()Returns the value stored in the cache when this entry was created or updated.abstract booleanWhether the old value is available.Methods inherited from class EventObject
toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Cache.Entry
getKey, unwrap
-
Field Details
-
eventType
-
-
Constructor Details
-
CacheEntryEvent
-
-
Method Details
-
getSource
- Overrides:
getSourcein classEventObject
-
getValue
Returns the value stored in the cache when this entry was created or updated.The value will be available for
CacheEntryCreatedListenerandCacheEntryUpdatedListener. Returns the same value asgetOldValue()forCacheEntryExpiredListenerandCacheEntryRemovedListener. 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:
getValuein interfaceCache.Entry<K,V> - Returns:
- the value corresponding to this entry
- See Also:
-
getOldValue
Returns the previous value that existed for entry in the cache before modification or removal. The old value will be available forCacheEntryUpdatedListener,CacheEntryExpiredListenerandCacheEntryRemovedListenerifCacheEntryListenerConfiguration.isOldValueRequired()is true. The old value may be available forCacheEntryUpdatedListener,CacheEntryExpiredListenerandCacheEntryRemovedListenerifCacheEntryListenerConfiguration.isOldValueRequired()is false.- Returns:
- the previous value or
nullif 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,CacheEntryExpiredListenerandCacheEntryRemovedListenerifCacheEntryListenerConfiguration.isOldValueRequired()is true. The old value may be available forCacheEntryUpdatedListener,CacheEntryExpiredListenerandCacheEntryRemovedListenerifCacheEntryListenerConfiguration.isOldValueRequired()is false.- Returns:
- true if the old value is definitely available
-
getEventType
-