Class MutableEntry<K,V>
java.lang.Object
com.loomcache.server.compute.MutableEntry<K,V>
- Type Parameters:
K- the type of the keyV- the type of the value
- All Implemented Interfaces:
CacheEntryProcessor.Entry<K,V>
Mutable entry implementation that wraps a map entry and tracks modifications.
This class is used internally by EntryProcessorExecutor to provide a mutable view of an entry during processor execution. It tracks whether the entry was modified, removed, or left unchanged.
Thread safety: This class is designed for single-threaded use within the context of an entry processor execution (which is locked by EntryProcessorExecutor).
-
Constructor Summary
ConstructorsConstructorDescriptionMutableEntry(K key, @Nullable V value, boolean exists) Create a new MutableEntry for an existing entry. -
Method Summary
Modifier and TypeMethodDescriptionbooleanexists()Check if this entry exists in the map.@Nullable VGet the new value (after modification, if any).key()Get the key of this entry.voidremove()Remove this entry from the map.voidSet the value of this entry.@Nullable Vvalue()Get the current value of this entry.
-
Constructor Details
-
MutableEntry
Create a new MutableEntry for an existing entry.- Parameters:
key- the key (must not be null)value- the current value (may be null)exists- whether the entry exists in the map- Throws:
NullPointerException- if key is null
-
-
Method Details
-
key
Description copied from interface:CacheEntryProcessor.EntryGet the key of this entry.- Specified by:
keyin interfaceCacheEntryProcessor.Entry<K,V> - Returns:
- the key (never null)
-
value
Description copied from interface:CacheEntryProcessor.EntryGet the current value of this entry.- Specified by:
valuein interfaceCacheEntryProcessor.Entry<K,V> - Returns:
- the value, or null if the entry does not exist
-
setValue
Description copied from interface:CacheEntryProcessor.EntrySet the value of this entry. This marks the entry for update within the processor execution.- Specified by:
setValuein interfaceCacheEntryProcessor.Entry<K,V> - Parameters:
value- the new value
-
remove
public void remove()Description copied from interface:CacheEntryProcessor.EntryRemove this entry from the map. After calling this,CacheEntryProcessor.Entry.value()will return null.- Specified by:
removein interfaceCacheEntryProcessor.Entry<K,V>
-
exists
public boolean exists()Description copied from interface:CacheEntryProcessor.EntryCheck if this entry exists in the map.- Specified by:
existsin interfaceCacheEntryProcessor.Entry<K,V> - Returns:
- true if the entry exists (value is not null or has been set)
-
getNewValue
Get the new value (after modification, if any).- Returns:
- the new value, or null if removed
-