|
|
|
I think it's designed that way.
But Andres may shade some more light on this? As Guillaume noted, it is designed that way, the intention of ObservableMap is to mimic an observable bean, you can't remove properties from a bean, can you?
On the other hand I see the benefit of having OM publish events when an element or all elements are removed, but the event triggered should not be a PropertyChangeEvent. This may be confusing as OM currently sends a PCE when a 'new" property is "added", so it should trigger a PropertyAddedEvent instead, but in a sense OM holds every property possible from the start (again if trying to mimic an observable bean). Two questions remain then: I guess we agree it's necessary to fire removal event. Otherwise, the Observable Map is somehow useless.
>PropertyChangeEvent requires an oldValue and newValue. If an entry is removed, I expect it to return: Alright, then I think the best course of action would be to subclass PCE to add a type [add|remove|change|clear] and continue using PropertyChangeListener. If a client would like to know more about the event then it can read the type field.
Added the following detail to fired events
|
||||||||||||||||||||||||||||||||||||||||||||
but is this really a bug or should more documentation explain the behaviour?
PropertyChangeEvent requires an oldValue and newValue.
When i remove a key from the map what values should the event carry?