@CompileStatic class DirtyCheckingMap extends java.lang.Object implements DirtyCheckableCollection, java.util.Map
A map that can be dirty checked.
Property access and String-keyed subscript access resolve to a map entry, as they do on the
wrapped map. Groovy 5 resolves both through a Map's own accessors before its entries, so the
accessors this wrapper declares (target, parent, property,
originalSize, assigned) would otherwise hide entries of those names, which the
plain map the wrapper replaces exposes; see getProperty(String). Statically compiled
dotted access binds to the accessor at compile time, as it always has; use get there.
| Type | Name and description |
|---|---|
boolean |
assigned |
int |
originalSize |
DirtyCheckable |
parent |
java.lang.String |
property |
java.lang.Object |
property |
java.util.Map |
target |
| Constructor and description |
|---|
DirtyCheckingMap(java.util.Map target, DirtyCheckable parent, java.lang.String property) |
DirtyCheckingMap(java.util.Map target, DirtyCheckable parent, java.lang.String property, boolean assigned) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
clear() |
|
java.lang.Object |
compute(java.lang.Object key, java.util.function.BiFunction remappingFunction) |
|
java.lang.Object |
computeIfAbsent(java.lang.Object key, java.util.function.Function mappingFunction) |
|
java.lang.Object |
computeIfPresent(java.lang.Object key, java.util.function.BiFunction remappingFunction) |
|
java.util.Set |
entrySet()The three views write through to the map, so they are returned wrapped in the tracking collection types — Groovy's Map.removeAll(Closure)/retainAll(Closure)
iterate entrySet(), and keySet().remove(...) / values().removeIf(...)
|
|
boolean |
equals(java.lang.Object other) |
|
java.lang.Object |
getProperty(java.lang.String name)Resolves a name this wrapper declares as an accessor to the map entry of that name, so map.parent and map['parent'] read what map.get('parent') reads.
|
|
boolean |
hasChanged() |
|
boolean |
hasChangedSize() |
|
boolean |
hasGrown() |
|
boolean |
hasShrunk() |
|
int |
hashCode() |
|
boolean |
isAssigned() |
|
java.util.Set |
keySet() |
|
java.lang.Object |
merge(java.lang.Object key, java.lang.Object value, java.util.function.BiFunction remappingFunction) |
|
java.lang.Object |
put(java.lang.Object key, java.lang.Object value) |
|
void |
putAll(java.util.Map m) |
|
java.lang.Object |
putIfAbsent(java.lang.Object key, java.lang.Object value) |
|
java.lang.Object |
remove(java.lang.Object key) |
|
boolean |
remove(java.lang.Object key, java.lang.Object value) |
|
java.lang.Object |
replace(java.lang.Object key, java.lang.Object value) |
|
boolean |
replace(java.lang.Object key, java.lang.Object oldValue, java.lang.Object newValue) |
|
void |
replaceAll(java.util.function.BiFunction function) |
|
void |
setProperty(java.lang.String name, java.lang.Object value)Stores a value under a name this wrapper declares as an accessor as a map entry, marking the owner dirty, so map.parent = value and map['parent'] = value do what
map.put('parent', value) does. |
|
java.util.Collection |
values() |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
The three views write through to the map, so they are returned wrapped in the tracking
collection types — Groovy's Map.removeAll(Closure)/retainAll(Closure)
iterate entrySet(), and keySet().remove(...) / values().removeIf(...)
are ordinary removal paths. Mutating an entry's value directly during iteration
(Map.Entry.setValue) remains untracked.
Resolves a name this wrapper declares as an accessor to the map entry of that name, so
map.parent and map['parent'] read what map.get('parent') reads.
Every other name resolves as it does on the wrapped map.
Stores a value under a name this wrapper declares as an accessor as a map entry, marking the
owner dirty, so map.parent = value and map['parent'] = value do what
map.put('parent', value) does. Every other name resolves as it does on the wrapped map.