Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


com.tangosol.util
Class InvocableMapHelper.SimpleEntry

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.SimpleMapEntry
          extended by com.tangosol.util.InvocableMapHelper.SimpleEntry

All Implemented Interfaces:
InvocableMap.Entry, MapTrigger.Entry, QueryMap.Entry, java.io.Serializable, java.lang.Cloneable, java.util.Map.Entry
Enclosing class:
InvocableMapHelper

public static class InvocableMapHelper.SimpleEntry
extends SimpleMapEntry

Simple implementation of the InvocableMap.Entry interface. This assumes that the underlying Map content does not change while a reference to the SimpleEntry is alive and may cache the entry's value to avoid an extra map lookup.


Field Summary
protected  java.util.Map m_map
          The map.

 

Fields inherited from class com.tangosol.util.SimpleMapEntry
m_oKey, m_oOrigValue, m_oValue, NO_VALUE

 

Constructor Summary
InvocableMapHelper.SimpleEntry(java.util.Map map, java.lang.Object oKey, boolean fReadOnly)
          Construct a SimpleEntry for a given map and a key.
InvocableMapHelper.SimpleEntry(java.lang.Object oKey, java.lang.Object oValue)
          Construct a SimpleEntry for a given key and value.

 

Method Summary
protected  void checkMutable()
          Verify that this SimpleEntry is mutable.
 boolean equals(java.lang.Object o)
          Compare this SimpleEntry with another object for equality.
 java.lang.Object getValue()
          Returns the value corresponding to this entry.
 int hashCode()
          Return a hash code value for the SimpleEntry object.
 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)
          Replaces the value corresponding to this entry with the specified value (optional operation).
 void setValue(java.lang.Object oValue, boolean fSynthetic)
          Store the value corresponding to this entry.
 java.lang.String toString()
          Provide a human-readable representation of the SimpleEntry object.

 

Methods inherited from class com.tangosol.util.SimpleMapEntry
clone, extract, getKey, getOriginalValue, isOriginalPresent, update

 

Field Detail

m_map

protected java.util.Map m_map
The map.

Constructor Detail

InvocableMapHelper.SimpleEntry

public InvocableMapHelper.SimpleEntry(java.util.Map map,
                                      java.lang.Object oKey,
                                      boolean fReadOnly)
Construct a SimpleEntry for a given map and a key.
Parameters:
map - the parent Map for this entry
oKey - the entry's key
fReadOnly - if true, the entry will be marked as read-only, preventing the setValue() and remove() methods from modifying the underlying map's content

InvocableMapHelper.SimpleEntry

public InvocableMapHelper.SimpleEntry(java.lang.Object oKey,
                                      java.lang.Object oValue)
Construct a SimpleEntry for a given key and value. The entry will be marked as read-only.
Parameters:
oKey - the entry's key
oValue - the entry's value

Method Detail

getValue

public java.lang.Object getValue()
Returns the value corresponding to this entry. If the mapping has been removed from the backing map (by the iterator's remove operation), the results of this call are undefined.
Specified by:
getValue in interface InvocableMap.Entry
Specified by:
getValue in interface java.util.Map.Entry
Overrides:
getValue in class SimpleMapEntry
Returns:
the value corresponding to this entry.

setValue

public java.lang.Object setValue(java.lang.Object oValue)
Replaces the value corresponding to this entry with the specified value (optional operation). (Writes through to the map.) The behavior of this call is undefined if the mapping has already been removed from the map (by the iterator's remove operation).
Specified by:
setValue in interface InvocableMap.Entry
Specified by:
setValue in interface java.util.Map.Entry
Overrides:
setValue in class SimpleMapEntry
Parameters:
oValue - new value to be stored in this entry
Returns:
old value corresponding to the entry

setValue

public 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.

Specified by:
setValue in interface InvocableMap.Entry
Overrides:
setValue in class SimpleMapEntry
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

isPresent

public boolean isPresent()
Determine if this Entry exists in the Map. If the Entry is not present, it can be created by calling InvocableMap.Entry.setValue(Object) or InvocableMap.Entry.setValue(Object, boolean). If the Entry is present, it can be destroyed by calling InvocableMap.Entry.remove(boolean).
Specified by:
isPresent in interface InvocableMap.Entry
Overrides:
isPresent in class SimpleMapEntry
Returns:
true iff this Entry is existent in the containing Map

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

Specified by:
remove in interface InvocableMap.Entry
Overrides:
remove in class SimpleMapEntry
Parameters:
fSynthetic - pass true only if the removal from the Map should be treated as a synthetic event

equals

public boolean equals(java.lang.Object o)
Compare this SimpleEntry with another object for equality.
Specified by:
equals in interface java.util.Map.Entry
Overrides:
equals in class SimpleMapEntry
Parameters:
o - an object reference or null
Returns:
true iff the passed object reference is a SimpleEntry object with the same key

hashCode

public int hashCode()
Return a hash code value for the SimpleEntry object.
Specified by:
hashCode in interface java.util.Map.Entry
Overrides:
hashCode in class SimpleMapEntry
Returns:
the hash code value for this map entry.

toString

public java.lang.String toString()
Provide a human-readable representation of the SimpleEntry object.
Overrides:
toString in class SimpleMapEntry
Returns:
a String representation of this SimpleEntry object

checkMutable

protected void checkMutable()
Verify that this SimpleEntry is mutable.

Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.