Package com.tangosol.util
Class InvocableMapHelper.RoutingMapTriggerEntry
- java.lang.Object
-
- com.tangosol.util.InvocableMapHelper.RoutingMapTriggerEntry
-
- All Implemented Interfaces:
InvocableMap.Entry
,MapTrigger.Entry
,QueryMap.Entry
,Map.Entry
- Direct Known Subclasses:
InvocableMapHelper.RoutingBinaryEntry
- Enclosing class:
- InvocableMapHelper
protected static class InvocableMapHelper.RoutingMapTriggerEntry extends Object implements MapTrigger.Entry
MapTrigger.Entry wrapper that routes the getValue() call onto getOriginalValue().
-
-
Field Summary
Fields Modifier and Type Field Description protected InvocableMap.Entry
m_entry
The underlying entry.
-
Constructor Summary
Constructors Modifier Constructor Description protected
RoutingMapTriggerEntry(BinaryEntry entry)
Construct a routing entry.protected
RoutingMapTriggerEntry(MapTrigger.Entry entry)
Construct a routing entry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
extract(ValueExtractor extractor)
Extract a value out of the Entry's key or value.Object
getKey()
Return the key corresponding to this entry.Object
getOriginalValue()
Determine the value that existed before the start of the mutating operation that is being evaluated by the trigger.Object
getValue()
Return an OriginalValue from the underlying entry.boolean
isOriginalPresent()
Determine whether or not the Entry existed before the start of the mutating operation that is being evaluated by the trigger.boolean
isPresent()
Determine if this Entry exists in the Map.boolean
isSynthetic()
Determine if this Entry has been synthetically mutated.void
remove(boolean fSynthetic)
Remove this Entry from the Map if it is present in the Map.Object
setValue(Object oValue)
Store the value corresponding to this entry.void
setValue(Object oValue, boolean fSynthetic)
Store the value corresponding to this entry.void
update(ValueUpdater updater, Object oValue)
Update the Entry's value.-
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.InvocableMap.Entry
asBinaryEntry, getValue, getValue
-
Methods inherited from interface com.tangosol.util.QueryMap.Entry
extractFromKey, extractFromValue
-
-
-
-
Field Detail
-
m_entry
protected InvocableMap.Entry m_entry
The underlying entry. We artificially widen the type to be able to extend this class.
-
-
Constructor Detail
-
RoutingMapTriggerEntry
protected RoutingMapTriggerEntry(MapTrigger.Entry entry)
Construct a routing entry.- Parameters:
entry
- the underlying MapTrigger.Entry
-
RoutingMapTriggerEntry
protected RoutingMapTriggerEntry(BinaryEntry entry)
Construct a routing entry.- Parameters:
entry
- the underlying BinaryEntry
-
-
Method Detail
-
getKey
public Object getKey()
Return the key corresponding to this entry. The resultant key does not necessarily exist within the containing Map, which is to say that InvocableMap.this.containsKey(getKey()) could return false. To test for the presence of this key within the Map, useInvocableMap.Entry.isPresent()
, and to create the entry for the key, useInvocableMap.Entry.setValue(V)
.- Specified by:
getKey
in interfaceInvocableMap.Entry
- Specified by:
getKey
in interfaceMap.Entry
- Returns:
- the key corresponding to this entry; may be null if the underlying Map supports null keys
-
getValue
public Object getValue()
Return an OriginalValue from the underlying entry.- Specified by:
getValue
in interfaceInvocableMap.Entry
- Specified by:
getValue
in interfaceMap.Entry
- Returns:
- the value corresponding to this entry; may be null if the value is null or if the Entry does not exist in the Map
-
extract
public Object extract(ValueExtractor extractor)
Extract a value out of the Entry's key or value. Calling this method is semantically equivalent to extractor.extract(entry.getValue()), but this method may be significantly less expensive. For example, the resultant value may be obtained from a forward index, avoiding a potential object de-serialization.- Specified by:
extract
in interfaceQueryMap.Entry
- Parameters:
extractor
- a ValueExtractor to apply to the Entry's key or value- Returns:
- the extracted value
-
getOriginalValue
public Object getOriginalValue()
Description copied from interface:MapTrigger.Entry
Determine the value that existed before the start of the mutating operation that is being evaluated by the trigger.- Specified by:
getOriginalValue
in interfaceMapTrigger.Entry
- Returns:
- the original value corresponding to this Entry; may be null if the value is null or if the Entry did not exist in the Map
- Throws:
UnsupportedOperationException
-
setValue
public Object setValue(Object oValue)
Description copied from interface:InvocableMap.Entry
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).- Specified by:
setValue
in interfaceInvocableMap.Entry
- Specified by:
setValue
in interfaceMap.Entry
- Parameters:
oValue
- the new value for this Entry- Returns:
- the previous value of this Entry, or null if the Entry did not exist
- Throws:
UnsupportedOperationException
-
setValue
public void setValue(Object oValue, boolean fSynthetic)
Description copied from interface:InvocableMap.Entry
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.- Specified by:
setValue
in interfaceInvocableMap.Entry
- Parameters:
oValue
- 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- Throws:
UnsupportedOperationException
-
update
public void update(ValueUpdater updater, Object oValue)
Description copied from interface:InvocableMap.Entry
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:
update
in interfaceInvocableMap.Entry
- Parameters:
updater
- a ValueUpdater used to modify the Entry's valueoValue
- the new value for this Entry- Throws:
UnsupportedOperationException
-
remove
public void remove(boolean fSynthetic)
Description copied from interface:InvocableMap.Entry
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()).- Specified by:
remove
in interfaceInvocableMap.Entry
- Parameters:
fSynthetic
- pass true only if the removal from the Map should be treated as a synthetic event- Throws:
UnsupportedOperationException
-
isPresent
public boolean isPresent()
Description copied from interface:InvocableMap.Entry
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:
isPresent
in interfaceInvocableMap.Entry
- Returns:
- true iff this Entry is existent in the containing Map
- Throws:
UnsupportedOperationException
-
isSynthetic
public boolean isSynthetic()
Description copied from interface:InvocableMap.Entry
Determine if this Entry has been synthetically mutated. This method returnsfalse
if either a non-synthetic update was made or the entry has not been modified.- Specified by:
isSynthetic
in interfaceInvocableMap.Entry
- Returns:
- true if the Entry has been synthetically mutated
- Throws:
UnsupportedOperationException
-
isOriginalPresent
public boolean isOriginalPresent()
Description copied from interface:MapTrigger.Entry
Determine whether or not the Entry existed before the start of the mutating operation that is being evaluated by the trigger.- Specified by:
isOriginalPresent
in interfaceMapTrigger.Entry
- Returns:
- true iff this Entry was existent in the containing Map
- Throws:
UnsupportedOperationException
-
-