Class OTrackedMap<T>
- All Implemented Interfaces:
ORecordElement,OTrackedMultiValue<Object,,T> Serializable,Cloneable,Map<Object,,T> SequencedMap<Object,T>
- Direct Known Subclasses:
ORecordLazyMap
public class OTrackedMap<T>
extends LinkedHashMap<Object,T>
implements ORecordElement, OTrackedMultiValue<Object,T>, Serializable
Implementation of LinkedHashMap bound to a source ORecord object to keep track of changes. This
avoid to call the makeDirty() by hand when the map is changed.
- Author:
- Luca Garulli (l.garulli--(at)--orientdb.com)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> Nested classes/interfaces inherited from interface com.orientechnologies.orient.core.db.record.ORecordElement
ORecordElement.STATUS -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOTrackedMap(ORecordElement iSourceRecord) OTrackedMap(ORecordElement iRecord, Map<Object, T> iOrigin, Class<?> cls) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddInternal(T e) voidclear()voiddisableTracking(ORecordElement document) voidenableTracking(ORecordElement parent) Class<?> getOwner()booleanbooleanvoidputInternal(Object key, T value) voidreplace(OMultiValueChangeEvent<Object, Object> event, Object newValue) returnOriginalState(List<OMultiValueChangeEvent<Object, T>> multiValueChangeEvents) Reverts all operations that were performed on collection and return original collection state.setDirty()Marks the instance as dirty.voidvoidMethods inherited from class java.util.LinkedHashMap
containsValue, entrySet, forEach, get, getOrDefault, keySet, newLinkedHashMap, putFirst, putLast, removeEldestEntry, replaceAll, reversed, sequencedEntrySet, sequencedKeySet, sequencedValues, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, newHashMap, putIfAbsent, remove, replace, replace, sizeMethods inherited from class java.util.AbstractMap
equals, hashCode, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, putIfAbsent, remove, replace, replace, sizeMethods inherited from interface java.util.SequencedMap
firstEntry, lastEntry, pollFirstEntry, pollLastEntry
-
Field Details
-
sourceRecord
-
genericClass
-
-
Constructor Details
-
OTrackedMap
-
OTrackedMap
-
-
Method Details
-
getOwner
- Specified by:
getOwnerin interfaceORecordElement- Returns:
- Returns record element which contains given one.
-
addInternal
- Specified by:
addInternalin interfaceOTrackedMultiValue<Object,T>
-
putInternal
-
put
-
remove
-
clear
public void clear() -
putAll
-
setDirty
Description copied from interface:ORecordElementMarks the instance as dirty. The dirty status could be propagated up if the implementation supports ownership concept.- Specified by:
setDirtyin interfaceORecordElement- Returns:
- The object it self. Useful to call methods in chain.
-
setDirtyNoChanged
public void setDirtyNoChanged()- Specified by:
setDirtyNoChangedin interfaceORecordElement
-
returnOriginalState
public Map<Object,T> returnOriginalState(List<OMultiValueChangeEvent<Object, T>> multiValueChangeEvents) Description copied from interface:OTrackedMultiValueReverts all operations that were performed on collection and return original collection state.- Specified by:
returnOriginalStatein interfaceOTrackedMultiValue<Object,T> - Parameters:
multiValueChangeEvents- List of operations that were performed on collection.- Returns:
- Original collection state.
-
getGenericClass
- Specified by:
getGenericClassin interfaceOTrackedMultiValue<Object,T>
-
replace
- Specified by:
replacein interfaceOTrackedMultiValue<Object,T>
-
enableTracking
- Specified by:
enableTrackingin interfaceOTrackedMultiValue<Object,T>
-
disableTracking
- Specified by:
disableTrackingin interfaceOTrackedMultiValue<Object,T>
-
transactionClear
public void transactionClear()- Specified by:
transactionClearin interfaceOTrackedMultiValue<Object,T>
-
isModified
public boolean isModified()- Specified by:
isModifiedin interfaceOTrackedMultiValue<Object,T>
-
isTransactionModified
public boolean isTransactionModified()- Specified by:
isTransactionModifiedin interfaceOTrackedMultiValue<Object,T>
-
getTimeLine
- Specified by:
getTimeLinein interfaceOTrackedMultiValue<Object,T>
-
getTransactionTimeLine
- Specified by:
getTransactionTimeLinein interfaceOTrackedMultiValue<Object,T>
-