Class MapProperty<S,K,V>
- java.lang.Object
-
- org.eclipse.core.databinding.property.map.MapProperty<S,K,V>
-
- Type Parameters:
S- type of the source objectK- type of the keys to the mapV- type of the values in the map
- All Implemented Interfaces:
IProperty,IMapProperty<S,K,V>
- Direct Known Subclasses:
DelegatingMapProperty,SimpleMapProperty
public abstract class MapProperty<S,K,V> extends Object implements IMapProperty<S,K,V>
Abstract implementation of IMapProperty- Since:
- 1.2
- Implementation Note:
- If methods are added to the interface which this class implements then implementations of those methods must be added to this class.
-
-
Constructor Summary
Constructors Constructor Description MapProperty()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<K,V>doGetMap(S source)Returns a Map with the current contents of the source's map propertyprotected voiddoSetMap(S source, Map<K,V> map)Updates the property on the source with the specified change.protected voiddoUpdateMap(S source, MapDiff<K,V> diff)Updates the property on the source with the specified change.Map<K,V>getMap(S source)By default, this method returnsCollections.EMPTY_MAPin case the source object isnull.IObservableFactory<S,IObservableMap<K,V>>mapFactory()Returns a factory for creating observable maps tracking this property of a particular property source.IObservableFactory<S,IObservableMap<K,V>>mapFactory(Realm realm)Returns a factory for creating observable maps in the given realm, tracking this property of a particular property source.IObservableMap<K,V>observe(S source)Returns an observable map observing this map property on the given property source<U extends S>
IObservableMap<K,V>observeDetail(IObservableValue<U> master)Returns an observable map on the master observable's realm which tracks this property of the values in the entry set ofmaster.voidsetMap(S source, Map<K,V> map)Updates the property on the source with the specified change.voidupdateMap(S source, MapDiff<K,V> diff)Updates the property on the source with the specified change.<T> IMapProperty<S,K,T>values(IValueProperty<? super V,T> detailValues)Returns the nested combination of this property and the specified detail value property.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.core.databinding.property.map.IMapProperty
getKeyType, getValueType, observe
-
-
-
-
Method Detail
-
getMap
public Map<K,V> getMap(S source)
By default, this method returnsCollections.EMPTY_MAPin case the source object isnull. Otherwise, this method delegates todoGetMap(Object).Clients may override this method if they e.g. want to return a specific default map in case the source object is
null.- Specified by:
getMapin interfaceIMapProperty<S,K,V>- Parameters:
source- the property source (may be null)- Returns:
- a Map with the current contents of the source's map property
- Since:
- 1.3
- See Also:
doGetMap(Object)
-
doGetMap
protected Map<K,V> doGetMap(S source)
Returns a Map with the current contents of the source's map property- Parameters:
source- the property source- Returns:
- a Map with the current contents of the source's map property
- Since:
- 1.6
- Restriction:
- This method is not intended to be referenced by clients.
-
setMap
public final void setMap(S source, Map<K,V> map)
Description copied from interface:IMapPropertyUpdates the property on the source with the specified change.Note: This method is made available to facilitate basic property access. However if the property source lacks property change notification, then observables on the source object may not be notified of the change. In most cases it is preferable to modify the source through an
IObservableMapthan through the property directly.- Specified by:
setMapin interfaceIMapProperty<S,K,V>- Parameters:
source- the property source (may be null)map- the new map- Since:
- 1.3
-
doSetMap
protected void doSetMap(S source, Map<K,V> map)
Updates the property on the source with the specified change.- Parameters:
source- the property sourcemap- the new map- Since:
- 1.6
- Restriction:
- This method is not intended to be referenced by clients.
-
updateMap
public final void updateMap(S source, MapDiff<K,V> diff)
Description copied from interface:IMapPropertyUpdates the property on the source with the specified change.Note: This method is made available to facilitate basic property access. However if the property source lacks property change notification, then observables on the source object may not be notified of the change. In most cases it is preferable to modify the source through an
IObservableMapthan through the property directly.- Specified by:
updateMapin interfaceIMapProperty<S,K,V>- Parameters:
source- the property source (may be null)diff- a diff describing the change- Since:
- 1.3
-
doUpdateMap
protected void doUpdateMap(S source, MapDiff<K,V> diff)
Updates the property on the source with the specified change.- Parameters:
source- the property sourcediff- a diff describing the change- Since:
- 1.6
- Restriction:
- This method is not intended to be referenced by clients.
-
observe
public IObservableMap<K,V> observe(S source)
Description copied from interface:IMapPropertyReturns an observable map observing this map property on the given property source- Specified by:
observein interfaceIMapProperty<S,K,V>- Parameters:
source- the property source- Returns:
- an observable map observing this map-typed property on the given property source
-
mapFactory
public IObservableFactory<S,IObservableMap<K,V>> mapFactory()
Description copied from interface:IMapPropertyReturns a factory for creating observable maps tracking this property of a particular property source.- Specified by:
mapFactoryin interfaceIMapProperty<S,K,V>- Returns:
- a factory for creating observable maps tracking this property of a particular property source.
-
mapFactory
public IObservableFactory<S,IObservableMap<K,V>> mapFactory(Realm realm)
Description copied from interface:IMapPropertyReturns a factory for creating observable maps in the given realm, tracking this property of a particular property source.- Specified by:
mapFactoryin interfaceIMapProperty<S,K,V>- Parameters:
realm- the realm- Returns:
- a factory for creating observable maps in the given realm, tracking this property of a particular property source.
-
observeDetail
public <U extends S> IObservableMap<K,V> observeDetail(IObservableValue<U> master)
Description copied from interface:IMapPropertyReturns an observable map on the master observable's realm which tracks this property of the values in the entry set ofmaster.- Specified by:
observeDetailin interfaceIMapProperty<S,K,V>- Parameters:
master- the master observable- Returns:
- an observable map on the master observable's realm which tracks
this property of the values in the entry set of
master.
-
values
public final <T> IMapProperty<S,K,T> values(IValueProperty<? super V,T> detailValues)
Description copied from interface:IMapPropertyReturns the nested combination of this property and the specified detail value property. Note that because this property is a projection of value properties over a values collection, the only modifications supported are through theIObservableMap.put(Object, Object)andMap.putAll(java.util.Map)methods. In the latter case, this property does not entries for keys not already contained in the master map's key set. Modifications made through the returned property are delegated to the detail property, using the corresponding entry value from the master property as the source.- Specified by:
valuesin interfaceIMapProperty<S,K,V>- Parameters:
detailValues- the detail property- Returns:
- the nested combination of the master map and detail value properties.
-
-