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 object
K - type of the keys to the map
V - 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 Details

    • MapProperty

      public MapProperty()
  • Method Details

    • getMap

      public Map<K,V> getMap(S source)
      By default, this method returns Collections.EMPTY_MAP in case the source object is null. Otherwise, this method delegates to doGetMap(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:
      getMap in interface IMapProperty<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

      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: IMapProperty
      Updates 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 IObservableMap than through the property directly.

      Specified by:
      setMap in interface IMapProperty<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 source
      map - 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: IMapProperty
      Updates 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 IObservableMap than through the property directly.

      Specified by:
      updateMap in interface IMapProperty<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 source
      diff - 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: IMapProperty
      Returns an observable map observing this map property on the given property source
      Specified by:
      observe in interface IMapProperty<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: IMapProperty
      Returns a factory for creating observable maps tracking this property of a particular property source.
      Specified by:
      mapFactory in interface IMapProperty<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: IMapProperty
      Returns a factory for creating observable maps in the given realm, tracking this property of a particular property source.
      Specified by:
      mapFactory in interface IMapProperty<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: IMapProperty
      Returns an observable map on the master observable's realm which tracks this property of the values in the entry set of master.
      Specified by:
      observeDetail in interface IMapProperty<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: IMapProperty
      Returns 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 the IObservableMap.put(Object, Object) and Map.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:
      values in interface IMapProperty<S,K,V>
      Parameters:
      detailValues - the detail property
      Returns:
      the nested combination of the master map and detail value properties.