Oracle® Coherence Java API Reference
v3.5

E14977-01

com.tangosol.util
Interface InvocableMap.Entry

All Superinterfaces:
java.util.Map.Entry, QueryMap.Entry
All Known Subinterfaces:
BinaryEntry, MapTrigger.Entry
All Known Implementing Classes:
InvocableMapHelper.SimpleEntry
Enclosing interface:
InvocableMap

public static interface InvocableMap.Entry
extends QueryMap.Entry

An InvocableMap.Entry contains additional information and exposes additional operations that the basic Map.Entry does not. It allows non-existent entries to be represented, thus allowing their optional creation. It allows existent entries to be removed from the Map. It supports a number of optimizations that can ultimately be mapped through to indexes and other data structures of the underlying Map.


Method Summary
 java.lang.Object getKey()
          Return the key corresponding to this entry.
 java.lang.Object getValue()
          Return the value corresponding to this entry.
 boolean isPresent()
          Determine if this Entry exists in the Map.
 void remove(boolean fSynthetic)
          Remove this Entry from the Map if it is present in the Map.
 java.lang.Object setValue(java.lang.Object oValue)
          Store the value corresponding to this entry.
 void setValue(java.lang.Object oValue, boolean fSynthetic)
          Store the value corresponding to this entry.
 void update(ValueUpdater updater, java.lang.Object oValue)
          Update the Entry's value.
 
Methods inherited from interface com.tangosol.util.QueryMap.Entry
extract
 
Methods inherited from interface java.util.Map.Entry
equals, hashCode
 

Method Detail

getKey

java.lang.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, use isPresent(), and to create the entry for the key, use setValue(java.lang.Object).

Specified by:
getKey in interface java.util.Map.Entry
Returns:
the key corresponding to this entry; may be null if the underlying Map supports null keys

getValue

java.lang.Object getValue()
Return the value corresponding to this entry. If the entry does not exist, then the value will be null. To differentiate between a null value and a non-existent entry, use isPresent().

Note: any modifications to the value retrieved using this method are not guaranteed to persist unless followed by a setValue(java.lang.Object) or update(com.tangosol.util.ValueUpdater, java.lang.Object) call.

Specified by:
getValue in interface java.util.Map.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

setValue

java.lang.Object setValue(java.lang.Object oValue)
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 interface java.util.Map.Entry
Parameters:
oValue - the new value for this Entry
Returns:
the previous value of this Entry, or null if the Entry did not exist

setValue

void setValue(java.lang.Object oValue,
              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.

Parameters:
oValue - the new value for this Entry
fSynthetic - pass true only if the insertion into or modification of the Map should be treated as a synthetic event

update

void update(ValueUpdater updater,
            java.lang.Object oValue)
Update the Entry's value. Calling this method is semantically equivalent to:
   Object oTarget = entry.getValue();
   updater.update(oTarget, oValue);
   entry.setValue(oTarget, 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.

Parameters:
updater - a ValueUpdater used to modify the Entry's value
oValue - the new value for this Entry

isPresent

boolean isPresent()
Determine if this Entry exists in the Map. If the Entry is not present, it can be created by calling setValue(java.lang.Object) or setValue(java.lang.Object). If the Entry is present, it can be destroyed by calling remove(boolean).

Returns:
true iff this Entry is existent in the containing Map

remove

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()).

Parameters:
fSynthetic - pass true only if the removal from the Map should be treated as a synthetic event

Oracle® Coherence Java API Reference
v3.5

E14977-01

Copyright © 2000, 2009, Oracle. All rights reserved.