Record Class ReadOnlyEntry<K,V>
java.lang.Object
java.lang.Record
com.loomcache.server.compute.ReadOnlyEntry<K,V>
- Type Parameters:
K- the type of the keyV- the type of the value
- All Implemented Interfaces:
CacheEntryProcessor.Entry<K,V>, ReadOnlyCacheEntryProcessor.ReadOnlyEntry<K, V>
public record ReadOnlyEntry<K,V> (K key, @Nullable V value, boolean exists)
extends Record
implements ReadOnlyCacheEntryProcessor.ReadOnlyEntry<K,V>
Read-only wrapper implementation of Entry that throws UnsupportedOperationException
on mutation attempts.
This class is used internally by EntryProcessorExecutor to provide a read-only view of an entry when a ReadOnlyCacheEntryProcessor is executed. Any attempt to call setValue or remove will throw UnsupportedOperationException.
-
Constructor Summary
ConstructorsConstructorDescriptionReadOnlyEntry(K key, @Nullable V value, boolean exists) Create a new read-only entry wrapper. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.booleanexists()Returns the value of theexistsrecord component.final inthashCode()Returns a hash code value for this object.key()Returns the value of thekeyrecord component.voidremove()Remove this entry from the map.voidSet the value of this entry.final StringtoString()Returns a string representation of this record class.@Nullable Vvalue()Returns the value of thevaluerecord component.
-
Constructor Details
-
ReadOnlyEntry
Create a new read-only entry wrapper.- Parameters:
key- the key (must not be null)value- the value (may be null)exists- whether the entry exists in the map- Throws:
NullPointerException- if key is null
-
-
Method Details
-
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>
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
key
Returns the value of thekeyrecord component.- Specified by:
keyin interfaceCacheEntryProcessor.Entry<K,V> - Returns:
- the value of the
keyrecord component
-
value
Returns the value of thevaluerecord component.- Specified by:
valuein interfaceCacheEntryProcessor.Entry<K,V> - Returns:
- the value of the
valuerecord component
-
exists
public boolean exists()Returns the value of theexistsrecord component.- Specified by:
existsin interfaceCacheEntryProcessor.Entry<K,V> - Returns:
- the value of the
existsrecord component
-