public class SimpleMapEntry<K,V> extends Base implements MapTrigger.Entry<K,V>, Cloneable, Serializable
Base.LoggingWriter, Base.StackFrame
Modifier and Type | Field and Description |
---|---|
protected K |
m_oKey
The key.
|
protected V |
m_oOrigValue
The original value.
|
protected V |
m_oValue
The value.
|
protected static Object |
NO_VALUE
Constant used to indicate that the original value does not exist.
|
Modifier | Constructor and Description |
---|---|
protected |
SimpleMapEntry()
Default constructor.
|
protected |
SimpleMapEntry(K key)
Construct a SimpleMapEntry with just a key.
|
|
SimpleMapEntry(K key,
V value)
Construct a SimpleMapEntry with a key and a value.
|
|
SimpleMapEntry(K key,
V value,
V origValue)
Construct a SimpleMapEntry with a key, value and original value.
|
|
SimpleMapEntry(Map.Entry<K,V> entry)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Clone the Entry.
|
boolean |
equals(Object o)
Compares the specified object with this entry for equality.
|
<T,E> E |
extract(ValueExtractor<T,E> extractor)
Extract a value out of the Entry's key or value.
|
K |
getKey()
Return the key corresponding to this entry.
|
V |
getOriginalValue()
Determine the value that existed before the start of the mutating
operation that is being evaluated by the trigger.
|
V |
getValue()
Returns the value corresponding to this entry.
|
int |
hashCode()
Returns the hash code value for this map 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.
|
V |
setValue(V value)
Replaces the value corresponding to this entry with the specified
value (optional operation).
|
void |
setValue(V oValue,
boolean fSynthetic)
Store the value corresponding to this entry.
|
String |
toString()
Render the map entry as a String.
|
<U> void |
update(ValueUpdater<V,U> updater,
U value)
Update the Entry's value.
|
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
finalize, getClass, notify, notifyAll, wait, wait, wait
getValue
extractFromKey, extractFromValue
comparingByKey, comparingByKey, comparingByValue, comparingByValue
protected static final Object NO_VALUE
protected K m_oKey
protected V m_oValue
protected V m_oOrigValue
protected SimpleMapEntry()
protected SimpleMapEntry(K key)
key
- an object for the keypublic SimpleMapEntry(Map.Entry<K,V> entry)
entry
- an entry to copy frompublic SimpleMapEntry(K key, V value)
key
- an object for the keyvalue
- an object for the valuepublic K getKey()
InvocableMap.Entry.isPresent()
, and to create the entry for the key, use InvocableMap.Entry.setValue(V)
.public V getValue()
public V setValue(V value)
public V getOriginalValue()
getOriginalValue
in interface MapTrigger.Entry<K,V>
public boolean isOriginalPresent()
isOriginalPresent
in interface MapTrigger.Entry<K,V>
public void setValue(V oValue, boolean fSynthetic)
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.
setValue
in interface InvocableMap.Entry<K,V>
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 <U> void update(ValueUpdater<V,U> updater, U value)
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.
update
in interface InvocableMap.Entry<K,V>
U
- the class of the valueupdater
- a ValueUpdater used to modify the Entry's valuevalue
- the new value for this Entrypublic boolean isPresent()
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)
.isPresent
in interface InvocableMap.Entry<K,V>
public boolean isSynthetic()
false
if either a non-synthetic update was made or
the entry has not been modified.isSynthetic
in interface InvocableMap.Entry<K,V>
public void remove(boolean fSynthetic)
InvocableMap.Entry
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()).
remove
in interface InvocableMap.Entry<K,V>
fSynthetic
- pass true only if the removal from the Map should
be treated as a synthetic eventUnsupportedOperationException
- by defaultpublic <T,E> E extract(ValueExtractor<T,E> extractor)
extract
in interface QueryMap.Entry<K,V>
T
- the type of the value to extract fromE
- the type of value that will be extractedextractor
- a ValueExtractor to apply to the Entry's key or valuepublic boolean equals(Object o)
(e1.getKey()==null ? e2.getKey()==null : e1.getKey().equals(e2.getKey())) && (e1.getValue()==null ? e2.getValue()==null : e1.getValue().equals(e2.getValue()))This ensures that the equals method works properly across different implementations of the Map.Entry interface.
public int hashCode()
(e.getKey()==null ? 0 : e.getKey().hashCode()) ^ (e.getValue()==null ? 0 : e.getValue().hashCode())This ensures that e1.equals(e2) implies that e1.hashCode()==e2.hashCode() for any two Entries e1 and e2, as required by the general contract of Object.hashCode.
public String toString()