|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tangosol.util.Base
com.tangosol.util.InvocableMapHelper.SimpleEntry
public static class InvocableMapHelper.SimpleEntry
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 Map |
m_map
The map. |
Constructor Summary | |
---|---|
InvocableMapHelper.SimpleEntry(Map map,
Object oKey,
boolean fReadOnly)
Construct a SimpleEntry for a given map and a key. |
|
InvocableMapHelper.SimpleEntry(Object oKey,
Object oValue)
Construct a SimpleEntry for a given key and value. |
Method Summary | |
---|---|
protected void |
checkMutable()
Verify that this SimpleEntry is mutable. |
boolean |
equals(Object o)
Compare this SimpleEntry with another object for equality. |
Object |
extract(ValueExtractor extractor)
Extract a value out of the Entry's value. |
Object |
getKey()
Return the key corresponding to this entry. |
Object |
getValue()
Return 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. |
Object |
setValue(Object oValue)
Store the value corresponding to this entry. |
void |
setValue(Object oValue,
boolean fSynthetic)
Store the value corresponding to this entry. |
String |
toString()
Provide a human-readable representation of the SimpleEntry object. |
void |
update(ValueUpdater updater,
Object oValue)
Update the Entry's value. |
Field Detail |
---|
protected Map m_map
Constructor Detail |
---|
public InvocableMapHelper.SimpleEntry(Map map, Object oKey, boolean fReadOnly)
map
- the parent Map for this entryoKey
- the entry's keyfReadOnly
- if true, the entry will be marked as
read-only, preventing the setValue() and
remove() methods from modifying the
underlying map's contentpublic InvocableMapHelper.SimpleEntry(Object oKey, Object oValue)
oKey
- the entry's keyoValue
- the entry's valueMethod Detail |
---|
public Object getKey()
InvocableMap.Entry.isPresent()
, and to create the entry for the key, use
InvocableMap.Entry.setValue(java.lang.Object)
.
getKey
in interface InvocableMap.Entry
getKey
in interface Map.Entry
public Object getValue()
InvocableMap.Entry.isPresent()
.
Note: any modifications to the value retrieved using this
method are not guaranteed to persist unless followed by a
InvocableMap.Entry.setValue(java.lang.Object)
or InvocableMap.Entry.update(com.tangosol.util.ValueUpdater, java.lang.Object)
call.
getValue
in interface InvocableMap.Entry
getValue
in interface Map.Entry
public Object setValue(Object oValue)
setValue
in interface InvocableMap.Entry
setValue
in interface Map.Entry
oValue
- the new value for this Entry
public void setValue(Object oValue, boolean fSynthetic)
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.
setValue
in interface InvocableMap.Entry
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 eventpublic Object extract(ValueExtractor extractor)
extract
in interface QueryMap.Entry
extractor
- a ValueExtractor to apply to the Entry's value
public void update(ValueUpdater updater, Object oValue)
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.
update
in interface InvocableMap.Entry
updater
- a ValueUpdater used to modify the Entry's valuepublic boolean isPresent()
InvocableMap.Entry.setValue(java.lang.Object)
or
InvocableMap.Entry.setValue(java.lang.Object)
. If the Entry is present, it can be destroyed by
calling InvocableMap.Entry.remove(boolean)
.
isPresent
in interface InvocableMap.Entry
public void remove(boolean fSynthetic)
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()).
remove
in interface InvocableMap.Entry
fSynthetic
- pass true only if the removal from the Map
should be treated as a synthetic eventpublic boolean equals(Object o)
equals
in interface Map.Entry
o
- an object reference or null
public int hashCode()
hashCode
in interface Map.Entry
public String toString()
protected void checkMutable()
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |