Class ConverterCollections.ConverterMapEvent.ConverterMapEventBinaryEntry
- java.lang.Object
-
- com.tangosol.util.ConverterCollections.ConverterMapEvent.ConverterMapEventEntry
-
- com.tangosol.util.ConverterCollections.ConverterMapEvent.ConverterMapEventBinaryEntry
-
- All Implemented Interfaces:
BinaryEntry<K,V>,InvocableMap.Entry<K,V>,QueryMap.Entry<K,V>,Map.Entry<K,V>
- Enclosing class:
- ConverterCollections.ConverterMapEvent<K,V>
protected class ConverterCollections.ConverterMapEvent.ConverterMapEventBinaryEntry extends ConverterCollections.ConverterMapEvent.ConverterMapEventEntry implements BinaryEntry<K,V>
ConverterMapEventBinaryEntry provides both the Map Entry and the BinaryEntry interfaces to the information encapsulated inside the ConverterMapEvent.
-
-
Field Summary
-
Fields inherited from class com.tangosol.util.ConverterCollections.ConverterMapEvent.ConverterMapEventEntry
m_fNewValue
-
-
Constructor Summary
Constructors Constructor Description ConverterMapEventBinaryEntry(boolean fNewValue)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexpire(long cMillis)Update the entry with the specified expiry delay.<T,E>
Eextract(ValueExtractor<T,E> extractor)Depending upon the type of the ValueExtractor route the call to the appropriate extract method.ObservableMap<K,V>getBackingMap()Obtain a reference to the backing map that this Entry corresponds to.BackingMapContextgetBackingMapContext()Obtain a reference to thebacking map contextfor the cache that this Entry corresponds to.BackingMapManagerContextgetContext()Return the context this entry operates within.longgetExpiry()Return the number of milliseconds remaining before the specified entry is scheduled to expire.BinarygetOriginalBinaryValue()Return a raw original binary value for this entry.VgetOriginalValue()Return an original value for this entry.SerializergetSerializer()Return aSerializerthat is used to serialize/deserialize this entry.booleanisPresent()Determine if this Entry exists in the Map.booleanisReadOnly()Check whether this BinaryEntry allows data modification operations.booleanisSynthetic()Determine if this Entry has been synthetically mutated.voidremove(boolean fSynthetic)Remove this Entry from the Map if it is present in the Map.voidsetValue(V value, boolean fSynthetic)Store the value corresponding to this entry.<T> voidupdate(ValueUpdater<V,T> updater, T value)Update the Entry's value.voidupdateBinaryValue(Binary binValue)Update the binary value for this entry.voidupdateBinaryValue(Binary binValue, boolean fSynthetic)Update the binary value for this entry.-
Methods inherited from class com.tangosol.util.ConverterCollections.ConverterMapEvent.ConverterMapEventEntry
getBinaryKey, getBinaryValue, getKey, getValue, setValue
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.tangosol.util.BinaryEntry
getAssociatedEntry, getAssociatedEntry, getBinaryKey, getBinaryValue, getIndexMap, getKeyPartition, isValueChanged, isValueLoaded, isValueRemoved, isValueUpdated
-
Methods inherited from interface com.tangosol.util.InvocableMap.Entry
asBinaryEntry, getKey, getValue, getValue, getValue, setValue
-
Methods inherited from interface com.tangosol.util.QueryMap.Entry
extractFromKey, extractFromValue
-
-
-
-
Method Detail
-
isPresent
public boolean isPresent()
Determine if this Entry exists in the Map. If the Entry is not present, it can be created by callingInvocableMap.Entry.setValue(Object)orInvocableMap.Entry.setValue(Object, boolean). If the Entry is present, it can be destroyed by callingInvocableMap.Entry.remove(boolean).- Specified by:
isPresentin interfaceInvocableMap.Entry<K,V>- Returns:
- true iff this Entry is existent in the containing Map
-
isSynthetic
public boolean isSynthetic()
Determine if this Entry has been synthetically mutated. This method returnsfalseif either a non-synthetic update was made or the entry has not been modified.- Specified by:
isSyntheticin interfaceInvocableMap.Entry<K,V>- Returns:
- true if the Entry has been synthetically mutated
-
remove
public void remove(boolean fSynthetic)
Remove this Entry from the Map if it is present in the Map.This method supports both the operation corresponding to
Map.remove(java.lang.Object)as well as synthetic operations such as eviction. If the containing Map does not differentiate between the two, then this method will always be identical to InvocableMap.this.remove(getKey()).As of Coherence 12.1.2, if fSynthetic is true and the
BackingMapassociated with this entry is a ReadWriteBackingMap, this method will bypass theCacheStoreorBinaryEntryStore.- Specified by:
removein interfaceBinaryEntry<K,V>- Specified by:
removein interfaceInvocableMap.Entry<K,V>- Parameters:
fSynthetic- pass true only if the removal from the Map should be treated as a synthetic event
-
setValue
public void setValue(V value, boolean fSynthetic)
Store the value corresponding to this entry. If the entry does not exist, then the entry will be created by invoking this method, even with a null value (assuming the Map supports null values).Unlike the other form of
setValue, this form does not return the previous value, and as a result may be significantly less expensive (in terms of cost of execution) for certain Map implementations.As of Coherence 12.1.2, if fSynthetic is true and the
BackingMapassociated with this entry is a ReadWriteBackingMap, this method will bypass theCacheStoreorBinaryEntryStore.- Specified by:
setValuein interfaceBinaryEntry<K,V>- Specified by:
setValuein interfaceInvocableMap.Entry<K,V>- Parameters:
value- the new value for this EntryfSynthetic- pass true only if the insertion into or modification of the Map should be treated as a synthetic event
-
update
public <T> void update(ValueUpdater<V,T> updater, T value)
Update the Entry's value. Calling this method is semantically equivalent to:V target = entry.getValue(); updater.update(target, value); entry.setValue(target, false);
The benefit of using this method is that it may allow the Entry implementation to significantly optimize the operation, such as for purposes of delta updates and backup maintenance.- Specified by:
updatein interfaceInvocableMap.Entry<K,V>- Type Parameters:
T- the class of the value- Parameters:
updater- a ValueUpdater used to modify the Entry's valuevalue- the new value for this Entry
-
extract
public <T,E> E extract(ValueExtractor<T,E> extractor)
Depending upon the type of the ValueExtractor route the call to the appropriate extract method.- Specified by:
extractin interfaceQueryMap.Entry<K,V>- Type Parameters:
T- the type of the value to extract fromE- the type of value that will be extracted- Parameters:
extractor- the ValueExtractor to pass this Entry or value.- Returns:
- the extracted value.
-
getContext
public BackingMapManagerContext getContext()
Return the context this entry operates within.Note: This method is a shortcut for the
getBackingMapContext.getManagerContext()call.- Specified by:
getContextin interfaceBinaryEntry<K,V>- Returns:
- the BackingMapManagerContext for this entry
-
getSerializer
public Serializer getSerializer()
Return aSerializerthat is used to serialize/deserialize this entry.- Specified by:
getSerializerin interfaceBinaryEntry<K,V>- Returns:
- a
Serializerthat is used to serialize/deserialize this entry
-
updateBinaryValue
public void updateBinaryValue(Binary binValue)
Update the binary value for this entry.Passing a non-null binary is functionally equivalent to:
setValue(getContext().getValueFromInternalConverter().convert(binValue));
Passing null value is functionally equivalent to removing the entry.remove(false);
- Specified by:
updateBinaryValuein interfaceBinaryEntry<K,V>- Parameters:
binValue- new binary value to be stored in this entry or null
-
updateBinaryValue
public void updateBinaryValue(Binary binValue, boolean fSynthetic)
Update the binary value for this entry.Passing a non-null binary is functionally equivalent to:
setValue(getContext().getValueFromInternalConverter().convert(binValue));
Passing null value is functionally equivalent to removing the entry.remove(false);
This method will bypass anyCacheStoreorBinaryEntryStoreimplementations, iff fSynthetic is true and the backing map associated with this entry is a ReadWriteBackingMap.- Specified by:
updateBinaryValuein interfaceBinaryEntry<K,V>- Parameters:
binValue- new binary value to be stored in this entry or nullfSynthetic- pass true only if the insertion into or modification of the Map should be treated as a synthetic event
-
getOriginalValue
public V getOriginalValue()
Return an original value for this entry.- Specified by:
getOriginalValuein interfaceBinaryEntry<K,V>- Returns:
- an original value for this entry
-
getOriginalBinaryValue
public Binary getOriginalBinaryValue()
Return a raw original binary value for this entry.- Specified by:
getOriginalBinaryValuein interfaceBinaryEntry<K,V>- Returns:
- a raw original binary value for this entry; null if the original value did not exist
-
getBackingMap
public ObservableMap<K,V> getBackingMap()
Obtain a reference to the backing map that this Entry corresponds to. The returned Map should be used in a read-only manner.Note: This method is a shortcut for the
getBackingMapContext().getBackingMap()call. As of Coherence 3.7, the returned type has been narrowed to ObservableMap.- Specified by:
getBackingMapin interfaceBinaryEntry<K,V>- Returns:
- the backing map reference; null if the entry does not have any backing map association
-
getBackingMapContext
public BackingMapContext getBackingMapContext()
Obtain a reference to thebacking map contextfor the cache that this Entry corresponds to.- Specified by:
getBackingMapContextin interfaceBinaryEntry<K,V>- Returns:
- the corresponding BackingMapContext; null if the entry does not have any backing map association
-
expire
public void expire(long cMillis)
Update the entry with the specified expiry delay.Note: this method only has an effect only if the associated backing map implements the
CacheMapinterface- Specified by:
expirein interfaceBinaryEntry<K,V>- Parameters:
cMillis- the number of milliseconds until the entry will expire; passCacheMap.EXPIRY_DEFAULTto use the default expiry setting; passCacheMap.EXPIRY_NEVERto indicate that the entry should never expire
-
getExpiry
public long getExpiry()
Return the number of milliseconds remaining before the specified entry is scheduled to expire. If theBinaryEntry.expire(long)method has been called, the returned value will reflect the requested expiry delay. Otherwise if the entryexists, the returned value will represent the time remaining until the entry expires (orCacheMap.EXPIRY_NEVERif the entry will never expire). If the entry does not exist,CacheMap.EXPIRY_DEFAULTwill be returned.This method will make a "best effort" attempt to determine the expiry time remaining. In some cases, it may not be possible to determine the expiry (e.g. the backing-map does not implement the
CacheMapinterface), in which caseCacheMap.EXPIRY_DEFAULTwill be returned.- Specified by:
getExpiryin interfaceBinaryEntry<K,V>- Returns:
- the number of milliseconds remaining before the specified entry expires
-
isReadOnly
public boolean isReadOnly()
Check whether this BinaryEntry allows data modification operations.- Specified by:
isReadOnlyin interfaceBinaryEntry<K,V>- Returns:
- true iff the entry is "read-only"
-
-