public class ObservableMap
extends java.lang.Object
implements java.util.Map
// skip all properties whose value is a closure def map = new ObservableMap( {!(it instanceof Closure)} ) // skip all properties whose name matches a regex def map = new ObservableMap( { name, value -> !(name =~ /[A-Z+]/) } )The current implementation will trigger specialized events in the following scenarios, you need not register a different listener as those events extend from PropertyChangeEvent
Bound properties
Modifier and Type | Class and Description |
---|---|
static class |
ObservableMap.ChangeType |
static class |
ObservableMap.MultiPropertyEvent |
static class |
ObservableMap.PropertyAddedEvent |
static class |
ObservableMap.PropertyClearedEvent |
static class |
ObservableMap.PropertyEvent |
static class |
ObservableMap.PropertyRemovedEvent |
static class |
ObservableMap.PropertyUpdatedEvent |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLEARED_PROPERTY |
static java.lang.String |
CONTENT_PROPERTY |
static java.lang.String |
SIZE_PROPERTY |
Constructor and Description |
---|
ObservableMap() |
ObservableMap(Closure test) |
ObservableMap(java.util.Map delegate) |
ObservableMap(java.util.Map delegate,
Closure test) |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener) |
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set |
entrySet() |
boolean |
equals(java.lang.Object o) |
protected void |
fireMultiPropertyEvent(java.util.List<ObservableMap.PropertyEvent> events) |
protected void |
fireMultiPropertyEvent(ObservableMap.PropertyEvent[] events) |
protected void |
firePropertyAddedEvent(java.lang.Object key,
java.lang.Object value) |
protected void |
firePropertyClearedEvent(java.util.Map values) |
protected void |
firePropertyEvent(ObservableMap.PropertyEvent event) |
protected void |
firePropertyRemovedEvent(java.lang.Object key,
java.lang.Object value) |
protected void |
firePropertyUpdatedEvent(java.lang.Object key,
java.lang.Object oldValue,
java.lang.Object newValue) |
protected void |
fireSizeChangedEvent(int oldValue,
int newValue) |
java.lang.Object |
get(java.lang.Object key) |
java.util.Map |
getContent() |
protected java.util.Map |
getMapDelegate() |
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners() |
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners(java.lang.String propertyName) |
int |
getSize() |
protected Closure |
getTest() |
int |
hashCode() |
boolean |
hasListeners(java.lang.String propertyName) |
boolean |
isEmpty() |
java.util.Set |
keySet() |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value) |
void |
putAll(java.util.Map map) |
java.lang.Object |
remove(java.lang.Object key) |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener) |
int |
size() |
java.util.Collection |
values() |
public static final java.lang.String SIZE_PROPERTY
public static final java.lang.String CONTENT_PROPERTY
public static final java.lang.String CLEARED_PROPERTY
public ObservableMap()
public ObservableMap(Closure test)
public ObservableMap(java.util.Map delegate)
public ObservableMap(java.util.Map delegate, Closure test)
protected java.util.Map getMapDelegate()
protected Closure getTest()
public java.util.Map getContent()
protected void firePropertyClearedEvent(java.util.Map values)
protected void firePropertyAddedEvent(java.lang.Object key, java.lang.Object value)
protected void firePropertyUpdatedEvent(java.lang.Object key, java.lang.Object oldValue, java.lang.Object newValue)
protected void fireMultiPropertyEvent(java.util.List<ObservableMap.PropertyEvent> events)
protected void fireMultiPropertyEvent(ObservableMap.PropertyEvent[] events)
protected void firePropertyRemovedEvent(java.lang.Object key, java.lang.Object value)
protected void firePropertyEvent(ObservableMap.PropertyEvent event)
protected void fireSizeChangedEvent(int oldValue, int newValue)
public void clear()
clear
in interface java.util.Map
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map
public java.util.Set entrySet()
entrySet
in interface java.util.Map
public boolean equals(java.lang.Object o)
equals
in interface java.util.Map
equals
in class java.lang.Object
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
public int hashCode()
hashCode
in interface java.util.Map
hashCode
in class java.lang.Object
public boolean isEmpty()
isEmpty
in interface java.util.Map
public java.util.Set keySet()
keySet
in interface java.util.Map
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
public void putAll(java.util.Map map)
putAll
in interface java.util.Map
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
public int size()
size
in interface java.util.Map
public int getSize()
public java.util.Collection values()
values
in interface java.util.Map
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String propertyName)
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
public boolean hasListeners(java.lang.String propertyName)