Top Description Fields Constructors Methods
javax.cache.event

public abstract Class CacheEntryEvent<K, V>

extends EventObject
implements Cache.Entry<K, V>
Class Inheritance
All Implemented Interfaces
javax.cache.Cache.Entry
Type Parameters
<K>
the type of key
<V>
the type of value
Imports
javax.cache.Cache, javax.cache.configuration.CacheEntryListenerConfiguration, java.util.EventObject

A Cache entry event base class.
Author
Greg Luck
Since
1.0

Field Summary

Modifier and TypeField and Description
private EventType
Inherited from java.util.EventObject:
source

Constructor Summary

AccessConstructor and Description
public
CacheEntryEvent(Cache<K, V>
the cache that originated the event
source
,
EventType
the event type for this event
eventType
)

Constructs a cache entry event from a given cache as source

Method Summary

Modifier and TypeMethod and Description
public final EventType

Returns:

the event type.
getEventType
()

Gets the event type of this event

public abstract V

Returns:

the previous value or null if there was no previous value or the previous value is not available
getOldValue
()

Returns the previous value that existed for entry in the cache before modification or removal.

public final Cache<K, V>
getSource()

Overrides java.util.EventObject.getSource.

The object on which the Event initially occurred.
public abstract V

Returns:

the value corresponding to this entry
getValue
()

Redeclares javax.cache.Cache.Entry.getValue.

Returns the value stored in the cache when this entry was created or updated.
public abstract boolean

Returns:

true if the old value is definitely available
isOldValueAvailable
()

Whether the old value is available.

Inherited from java.util.EventObject:
toString

Field Detail

eventTypeback to summary
private EventType eventType

Constructor Detail

CacheEntryEventback to summary
public CacheEntryEvent(Cache<K, V> source, EventType eventType)

Constructs a cache entry event from a given cache as source

Parameters
source:Cache<K, V>

the cache that originated the event

eventType:EventType

the event type for this event

Method Detail

getEventTypeback to summary
public final EventType getEventType()

Gets the event type of this event

Returns:EventType

the event type.

getOldValueback to summary
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 for CacheEntryUpdatedListener, CacheEntryExpiredListener and CacheEntryRemovedListener if CacheEntryListenerConfiguration#isOldValueRequired() is true. The old value may be available for CacheEntryUpdatedListener, CacheEntryExpiredListener and CacheEntryRemovedListener if CacheEntryListenerConfiguration#isOldValueRequired() is false.

Returns:V

the previous value or null if there was no previous value or the previous value is not available

getSourceback to summary
public final Cache<K, V> getSource()

Overrides java.util.EventObject.getSource.

Doc from java.util.EventObject.getSource.

The object on which the Event initially occurred.

Returns:Cache<K, V>

the object on which the Event initially occurred

Annotations
@Override
getValueback to summary
public abstract V getValue()

Redeclares javax.cache.Cache.Entry.getValue.

Returns the value stored in the cache when this entry was created or updated.

The value will be available for CacheEntryCreatedListener and CacheEntryUpdatedListener. Returns the same value as getOldValue() for CacheEntryExpiredListener and CacheEntryRemovedListener. 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 method getOldValue().

Returns:V

the value corresponding to this entry

Annotations
@Override
See Also
getOldValue()
isOldValueAvailableback to summary
public abstract boolean isOldValueAvailable()

Whether the old value is available. The old value will be available for CacheEntryUpdatedListener, CacheEntryExpiredListener and CacheEntryRemovedListener if CacheEntryListenerConfiguration#isOldValueRequired() is true. The old value may be available for CacheEntryUpdatedListener, CacheEntryExpiredListener and CacheEntryRemovedListener if CacheEntryListenerConfiguration#isOldValueRequired() is false.

Returns:boolean

true if the old value is definitely available