public final class RemovalNotification<K,V>
extends java.util.AbstractMap.SimpleImmutableEntry<K,V>
Like other Entry instances associated with CacheBuilder, this class holds
strong references to the key and value, regardless of the type of references the cache may be
using.
| Modifier and Type | Field and Description |
|---|---|
private RemovalCause |
cause |
private static long |
serialVersionUID |
| Modifier | Constructor and Description |
|---|---|
private |
RemovalNotification(K key,
V value,
RemovalCause cause) |
| Modifier and Type | Method and Description |
|---|---|
static <K,V> RemovalNotification<K,V> |
create(K key,
V value,
RemovalCause cause)
Creates a new
RemovalNotification for the given key/value pair, with
the given cause for the removal. |
RemovalCause |
getCause()
Returns the cause for which the entry was removed.
|
boolean |
wasEvicted()
Returns
true if there was an automatic removal due to eviction (the cause is neither
RemovalCause.EXPLICIT nor RemovalCause.REPLACED). |
equals, getKey, getValue, hashCode, setValue, toStringprivate final RemovalCause cause
private static final long serialVersionUID
private RemovalNotification(@CheckForNull
K key,
@CheckForNull
V value,
RemovalCause cause)
public static <K,V> RemovalNotification<K,V> create(@CheckForNull K key, @CheckForNull V value, RemovalCause cause)
RemovalNotification for the given key/value pair, with
the given cause for the removal. The key and/or value may be null if they were already garbage collected.public RemovalCause getCause()
public boolean wasEvicted()
true if there was an automatic removal due to eviction (the cause is neither
RemovalCause.EXPLICIT nor RemovalCause.REPLACED).