Eclipse Platform
Release 3.6

org.eclipse.core.databinding.beans
Class BeansObservables

java.lang.Object
  extended by org.eclipse.core.databinding.beans.BeansObservables

public final class BeansObservables
extends Object

A factory for creating observable objects of Java objects that conform to the JavaBean specification for bound properties.

Since:
1.1

Field Summary
static boolean DEBUG
           
 
Constructor Summary
BeansObservables()
           
 
Method Summary
static IObservableFactory listFactory(Realm realm, String propertyName, Class elementType)
          Returns a factory for creating observable lists in the given realm, tracking the given property of a particular bean object
static IObservableFactory listFactory(String propertyName, Class elementType)
          Returns a factory for creating observable lists in the current default realm, tracking the given property of a particular bean object
static IObservableFactory mapPropertyFactory(Realm realm, String propertyName)
          Returns a factory for creating an observable map.
static IObservableFactory mapPropertyFactory(String propertyName)
          Returns a factory for creating an observable map.
static IObservableList observeDetailList(IObservableValue master, String propertyName, Class propertyType)
          Helper method for MasterDetailObservables.detailList(master, listFactory(master.getRealm(), propertyName, propertyType), propertyType)
static IObservableList observeDetailList(Realm realm, IObservableValue master, String propertyName, Class propertyType)
          Deprecated. Use observeDetailList(IObservableValue, String, Class) instead
static IObservableMap observeDetailMap(IObservableValue master, String propertyName)
          Helper method for MasterDetailObservables.detailMap(master, mapFactory(master.getRealm(), propertyName))
static IObservableMap observeDetailMap(Realm realm, IObservableValue master, String propertyName)
          Deprecated. Use observeDetailMap(IObservableValue, String) instead
static IObservableSet observeDetailSet(IObservableValue master, String propertyName, Class propertyType)
          Helper method for MasterDetailObservables.detailSet(master, setFactory(master.getRealm(), propertyName), propertyType)
static IObservableSet observeDetailSet(Realm realm, IObservableValue master, String propertyName, Class propertyType)
          Deprecated. Use observeDetailSet(IObservableValue, String, Class) instead.
static IObservableValue observeDetailValue(IObservableValue master, Class masterType, String propertyName, Class propertyType)
          Helper method for MasterDetailObservables.detailValue(master, valueFactory(master.getRealm(), propertyName), propertyType) .
static IObservableValue observeDetailValue(IObservableValue master, String propertyName, Class propertyType)
          Helper method for MasterDetailObservables.detailValue(master, valueFactory(master.getRealm(), propertyName), propertyType)
static IObservableValue observeDetailValue(Realm realm, IObservableValue master, Class masterType, String propertyName, Class propertyType)
          Deprecated. Use observeDetailValue(IObservableValue, Class, String, Class) instead.
static IObservableValue observeDetailValue(Realm realm, IObservableValue master, String propertyName, Class propertyType)
          Deprecated. Use observeDetailValue(IObservableValue, String, Class) instead
static IObservableList observeList(Object bean, String propertyName)
          Returns an observable list in the default realm tracking the collection-typed named property of the given bean object.
static IObservableList observeList(Object bean, String propertyName, Class elementType)
          Returns an observable list in the default realm tracking the collection-typed named property of the given bean object.
static IObservableList observeList(Realm realm, Object bean, String propertyName)
          Returns an observable list in the given realm tracking the collection-typed named property of the given bean object.
static IObservableList observeList(Realm realm, Object bean, String propertyName, Class elementType)
          Returns an observable list in the given realm tracking the collection-typed named property of the given bean object.
static IObservableMap observeMap(IObservableSet domain, Class beanClass, String propertyName)
          Returns an observable map in the given observable set's realm tracking the current values of the named property for the beans in the given set.
static IObservableMap observeMap(IObservableSet domain, String propertyName)
          Returns an observable map in the given observable set's realm tracking the current values of the named property for the beans in the given set.
static IObservableMap observeMap(Object bean, String propertyName)
          Returns an observable map in the default realm tracking the map-typed named property of the given bean object.
static IObservableMap observeMap(Object bean, String propertyName, Class keyType, Class valueType)
          Returns an observable map in the default realm tracking the map-typed named property of the given bean object.
static IObservableMap observeMap(Realm realm, Object bean, String propertyName)
          Returns an observable map in the given realm tracking the map-typed named property of the given bean object.
static IObservableMap observeMap(Realm realm, Object bean, String propertyName, Class keyType, Class valueType)
          Returns an observable map in the given realm tracking the map-typed named property of the given bean object.
static IObservableMap[] observeMaps(IObservableSet domain, Class beanClass, String[] propertyNames)
          Returns an array of observable maps in the given observable set's realm tracking the current values of the named properties for the beans in the given set.
static IObservableMap[] observeMaps(IObservableSet domain, String[] propertyNames)
          Returns an array of observable maps in the given observable set's realm tracking the current values of the named properties for the beans in the given set.
static IObservableSet observeSet(Object bean, String propertyName)
          Returns an observable set in the default realm tracking the collection-typed named property of the given bean object
static IObservableSet observeSet(Object bean, String propertyName, Class elementType)
          Returns an observable set in the current default realm tracking the collection-typed named property of the given bean object.
static IObservableSet observeSet(Realm realm, Object bean, String propertyName)
          Returns an observable set in the given realm tracking the collection-typed named property of the given bean object
static IObservableSet observeSet(Realm realm, Object bean, String propertyName, Class elementType)
          Returns an observable set in the given realm tracking the collection-typed named property of the given bean object.
static IObservableValue observeValue(Object bean, String propertyName)
          Returns an observable value in the default realm tracking the current value of the named property of the given bean.
static IObservableValue observeValue(Realm realm, Object bean, String propertyName)
          Returns an observable value in the given realm tracking the current value of the named property of the given bean.
static IObservableFactory setFactory(Realm realm, String propertyName)
          Returns a factory for creating observable sets in the given realm, tracking the given property of a particular bean object
static IObservableFactory setFactory(Realm realm, String propertyName, Class elementType)
          Returns a factory for creating observable sets in the given realm, tracking the given property of a particular bean object
static IObservableFactory setFactory(String propertyName)
          Returns a factory for creating observable sets in the current default realm, tracking the given property of a particular bean object
static IObservableFactory setFactory(String propertyName, Class elementType)
          Returns a factory for creating observable sets in the current default realm, tracking the given property of a particular bean object
static IObservableFactory setToMapFactory(Class beanClass, String propertyName)
          Returns a factory for creating an observable map.
static IObservableFactory valueFactory(Realm realm, String propertyName)
          Returns a factory for creating observable values in the given realm, tracking the given property of a particular bean object
static IObservableFactory valueFactory(String propertyName)
          Returns a factory for creating observable values in the current default realm, tracking the given property of a particular bean object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values
Constructor Detail

BeansObservables

public BeansObservables()
Method Detail

observeValue

public static IObservableValue observeValue(Object bean,
                                            String propertyName)
Returns an observable value in the default realm tracking the current value of the named property of the given bean.

Parameters:
bean - the object
propertyName - the name of the property. May be nested e.g. "parent.name"
Returns:
an observable value tracking the current value of the named property of the given bean

observeValue

public static IObservableValue observeValue(Realm realm,
                                            Object bean,
                                            String propertyName)
Returns an observable value in the given realm tracking the current value of the named property of the given bean.

Parameters:
realm - the realm
bean - the object
propertyName - the name of the property. May be nested e.g. "parent.name"
Returns:
an observable value tracking the current value of the named property of the given bean

observeMap

public static IObservableMap observeMap(IObservableSet domain,
                                        String propertyName)
Returns an observable map in the given observable set's realm tracking the current values of the named property for the beans in the given set. Elements in the set which do not have the named property will have null values, and attempts to put values to these elements will be ignored.

Parameters:
domain - the set of bean objects
propertyName - the name of the property. May be nested e.g. "parent.name"
Returns:
an observable map tracking the current values of the named property for the beans in the given domain set
Since:
1.2

observeMap

public static IObservableMap observeMap(IObservableSet domain,
                                        Class beanClass,
                                        String propertyName)
Returns an observable map in the given observable set's realm tracking the current values of the named property for the beans in the given set.

Parameters:
domain - the set of bean objects
beanClass - the common base type of bean objects that may be in the set
propertyName - the name of the property. May be nested e.g. "parent.name"
Returns:
an observable map tracking the current values of the named property for the beans in the given domain set

observeMap

public static IObservableMap observeMap(Realm realm,
                                        Object bean,
                                        String propertyName)
Returns an observable map in the given realm tracking the map-typed named property of the given bean object.

Parameters:
realm - the realm
bean - the bean object
propertyName - the name of the property. May be nested e.g. "parent.name"
Returns:
an observable map tracking the map-typed named property of the given bean object
Since:
1.1

observeMap

public static IObservableMap observeMap(Realm realm,
                                        Object bean,
                                        String propertyName,
                                        Class keyType,
                                        Class valueType)
Returns an observable map in the given realm tracking the map-typed named property of the given bean object.

Parameters:
realm - the realm
bean - the bean object
propertyName - the name of the property. May be nested e.g. "parent.name"
keyType - the element type of the observable map's key set, or null if untyped
valueType - the element type of the observable map's values collection, or null if untyped
Returns:
an observable map tracking the map-typed named property of the given bean object
Since:
1.2

observeMap

public static IObservableMap observeMap(Object bean,
                                        String propertyName)
Returns an observable map in the default realm tracking the map-typed named property of the given bean object.

Parameters:
bean - the bean object
propertyName - the name of the property. May be nested e.g. "parent.name"
Returns:
an observable map tracking the map-typed named property of the given bean object
Since:
1.2

observeMap

public static IObservableMap observeMap(Object bean,
                                        String propertyName,
                                        Class keyType,
                                        Class valueType)
Returns an observable map in the default realm tracking the map-typed named property of the given bean object.

Parameters:
bean - the bean object
propertyName - the name of the property
keyType - the element type of the observable map's key set, or null if untyped
valueType - the element type of the observable map's values collection, or null if untyped
Returns:
an observable map tracking the map-typed named property of the given bean object
Since:
1.2

observeMaps

public static IObservableMap[] observeMaps(IObservableSet domain,
                                           String[] propertyNames)
Returns an array of observable maps in the given observable set's realm tracking the current values of the named properties for the beans in the given set. Elements in the set which do not have the named property will have null values, and attempts to put values to these elements will be ignored.

Parameters:
domain - the set of objects
propertyNames - the array of property names. May be nested e.g. "parent.name"
Returns:
an array of observable maps tracking the current values of the named propertys for the beans in the given domain set
Since:
1.2

observeMaps

public static IObservableMap[] observeMaps(IObservableSet domain,
                                           Class beanClass,
                                           String[] propertyNames)
Returns an array of observable maps in the given observable set's realm tracking the current values of the named properties for the beans in the given set.

Parameters:
domain - the set of objects
beanClass - the common base type of objects that may be in the set
propertyNames - the array of property names. May be nested e.g. "parent.name"
Returns:
an array of observable maps tracking the current values of the named propertys for the beans in the given domain set

observeList

public static IObservableList observeList(Realm realm,
                                          Object bean,
                                          String propertyName)
Returns an observable list in the given realm tracking the collection-typed named property of the given bean object. The returned list is mutable.

Parameters:
realm - the realm
bean - the object
propertyName - the name of the collection-typed property
Returns:
an observable list tracking the collection-typed named property of the given bean object
See Also:
observeList(Realm, Object, String, Class)

observeList

public static IObservableList observeList(Object bean,
                                          String propertyName)
Returns an observable list in the default realm tracking the collection-typed named property of the given bean object. The returned list is mutable.

Parameters:
bean - the object
propertyName - the name of the collection-typed property
Returns:
an observable list tracking the collection-typed named property of the given bean object
Since:
1.2
See Also:
observeList(Realm, Object, String, Class)

observeList

public static IObservableList observeList(Realm realm,
                                          Object bean,
                                          String propertyName,
                                          Class elementType)
Returns an observable list in the given realm tracking the collection-typed named property of the given bean object. The returned list is mutable. When an item is added or removed the setter is invoked for the list on the parent bean to provide notification to other listeners via PropertyChangeEvents. This is done to provide the same behavior as is expected from arrays as specified in the bean spec in section 7.2.

Parameters:
realm - the realm
bean - the bean object
propertyName - the name of the property
elementType - type of the elements in the list. If null and the property is an array the type will be inferred. If null and the property type cannot be inferred element type will be null.
Returns:
an observable list tracking the collection-typed named property of the given bean object

observeList

public static IObservableList observeList(Object bean,
                                          String propertyName,
                                          Class elementType)
Returns an observable list in the default realm tracking the collection-typed named property of the given bean object. The returned list is mutable. When an item is added or removed the setter is invoked for the list on the parent bean to provide notification to other listeners via PropertyChangeEvents. This is done to provide the same behavior as is expected from arrays as specified in the bean spec in section 7.2.

Parameters:
bean - the bean object
propertyName - the name of the property
elementType - type of the elements in the list. If null and the property is an array the type will be inferred. If null and the property type cannot be inferred element type will be null.
Returns:
an observable list tracking the collection-typed named property of the given bean object
Since:
1.2

observeSet

public static IObservableSet observeSet(Realm realm,
                                        Object bean,
                                        String propertyName)
Returns an observable set in the given realm tracking the collection-typed named property of the given bean object

Parameters:
realm - the realm
bean - the bean object
propertyName - the name of the property
Returns:
an observable set tracking the collection-typed named property of the given bean object

observeSet

public static IObservableSet observeSet(Object bean,
                                        String propertyName)
Returns an observable set in the default realm tracking the collection-typed named property of the given bean object

Parameters:
bean - the bean object
propertyName - the name of the property
Returns:
an observable set tracking the collection-typed named property of the given bean object
Since:
1.2

valueFactory

public static IObservableFactory valueFactory(Realm realm,
                                              String propertyName)
Returns a factory for creating observable values in the given realm, tracking the given property of a particular bean object

Parameters:
realm - the realm to use
propertyName - the name of the property. May be nested e.g. "parent.name"
Returns:
an observable value factory

valueFactory

public static IObservableFactory valueFactory(String propertyName)
Returns a factory for creating observable values in the current default realm, tracking the given property of a particular bean object

Parameters:
propertyName - the name of the property. May be nested e.g. "parent.name"
Returns:
an observable value factory
Since:
1.2

listFactory

public static IObservableFactory listFactory(Realm realm,
                                             String propertyName,
                                             Class elementType)
Returns a factory for creating observable lists in the given realm, tracking the given property of a particular bean object

Parameters:
realm - the realm to use
propertyName - the name of the property
elementType -
Returns:
an observable list factory

listFactory

public static IObservableFactory listFactory(String propertyName,
                                             Class elementType)
Returns a factory for creating observable lists in the current default realm, tracking the given property of a particular bean object

Parameters:
propertyName - the name of the property
elementType -
Returns:
an observable list factory
Since:
1.2

setFactory

public static IObservableFactory setFactory(Realm realm,
                                            String propertyName)
Returns a factory for creating observable sets in the given realm, tracking the given property of a particular bean object

Parameters:
realm - the realm to use
propertyName - the name of the property
Returns:
an observable set factory

setFactory

public static IObservableFactory setFactory(String propertyName)
Returns a factory for creating observable sets in the current default realm, tracking the given property of a particular bean object

Parameters:
propertyName - the name of the property
Returns:
an observable set factory
Since:
1.2

observeDetailValue

public static IObservableValue observeDetailValue(Realm realm,
                                                  IObservableValue master,
                                                  String propertyName,
                                                  Class propertyType)
Deprecated. Use observeDetailValue(IObservableValue, String, Class) instead

Helper method for MasterDetailObservables.detailValue(master, valueFactory(realm, propertyName), propertyType)

Parameters:
realm -
master -
propertyName - the name of the property. May be nested e.g. "parent.name"
propertyType - can be null
Returns:
an observable value that tracks the current value of the named property for the current value of the master observable value
See Also:
MasterDetailObservables

observeDetailValue

public static IObservableValue observeDetailValue(IObservableValue master,
                                                  String propertyName,
                                                  Class propertyType)
Helper method for MasterDetailObservables.detailValue(master, valueFactory(master.getRealm(), propertyName), propertyType)

Parameters:
master -
propertyName - the name of the property. May be nested e.g. "parent.name"
propertyType - can be null
Returns:
an observable value that tracks the current value of the named property for the current value of the master observable value
Since:
1.2
See Also:
MasterDetailObservables

observeDetailValue

public static IObservableValue observeDetailValue(Realm realm,
                                                  IObservableValue master,
                                                  Class masterType,
                                                  String propertyName,
                                                  Class propertyType)
Deprecated. Use observeDetailValue(IObservableValue, Class, String, Class) instead.

Helper method for MasterDetailObservables.detailValue(master, valueFactory(realm, propertyName), propertyType). This method returns an IBeanObservable with a PropertyDescriptor based on the given master type and property name.

Parameters:
realm - the realm
master - the master observable value, for example tracking the selection in a list
masterType - the type of the master observable value
propertyName - the property name. May be nested e.g. "parent.name"
propertyType - can be null
Returns:
an observable value that tracks the current value of the named property for the current value of the master observable value
Since:
1.1
See Also:
MasterDetailObservables

observeDetailValue

public static IObservableValue observeDetailValue(IObservableValue master,
                                                  Class masterType,
                                                  String propertyName,
                                                  Class propertyType)
Helper method for MasterDetailObservables.detailValue(master, valueFactory(master.getRealm(), propertyName), propertyType) . This method returns an IBeanObservable with a PropertyDescriptor based on the given master type and property name.

Parameters:
master - the master observable value, for example tracking the selection in a list
masterType - the type of the master observable value
propertyName - the property name. May be nested e.g. "parent.name"
propertyType - can be null
Returns:
an observable value that tracks the current value of the named property for the current value of the master observable value
Since:
1.2
See Also:
MasterDetailObservables

observeDetailList

public static IObservableList observeDetailList(Realm realm,
                                                IObservableValue master,
                                                String propertyName,
                                                Class propertyType)
Deprecated. Use observeDetailList(IObservableValue, String, Class) instead

Helper method for MasterDetailObservables.detailList(master, listFactory(realm, propertyName, propertyType), propertyType)

Parameters:
realm -
master -
propertyName -
propertyType - can be null
Returns:
an observable list that tracks the named property for the current value of the master observable value
See Also:
MasterDetailObservables

observeDetailList

public static IObservableList observeDetailList(IObservableValue master,
                                                String propertyName,
                                                Class propertyType)
Helper method for MasterDetailObservables.detailList(master, listFactory(master.getRealm(), propertyName, propertyType), propertyType)

Parameters:
master -
propertyName -
propertyType - can be null
Returns:
an observable list that tracks the named property for the current value of the master observable value
Since:
1.2
See Also:
MasterDetailObservables

observeDetailSet

public static IObservableSet observeDetailSet(Realm realm,
                                              IObservableValue master,
                                              String propertyName,
                                              Class propertyType)
Deprecated. Use observeDetailSet(IObservableValue, String, Class) instead.

Helper method for MasterDetailObservables.detailSet(master, setFactory(realm, propertyName), propertyType)

Parameters:
realm -
master -
propertyName -
propertyType - can be null
Returns:
an observable set that tracks the named property for the current value of the master observable value
See Also:
MasterDetailObservables

observeDetailSet

public static IObservableSet observeDetailSet(IObservableValue master,
                                              String propertyName,
                                              Class propertyType)
Helper method for MasterDetailObservables.detailSet(master, setFactory(master.getRealm(), propertyName), propertyType)

Parameters:
master -
propertyName -
propertyType - can be null
Returns:
an observable set that tracks the named property for the current value of the master observable value
Since:
1.2
See Also:
MasterDetailObservables

observeDetailMap

public static IObservableMap observeDetailMap(Realm realm,
                                              IObservableValue master,
                                              String propertyName)
Deprecated. Use observeDetailMap(IObservableValue, String) instead

Helper method for MasterDetailObservables.detailMap(master, mapFactory(realm, propertyName))

Parameters:
realm - the realm
master -
propertyName -
Returns:
an observable map that tracks the map-type named property for the current value of the master observable value.
Since:
1.1

observeDetailMap

public static IObservableMap observeDetailMap(IObservableValue master,
                                              String propertyName)
Helper method for MasterDetailObservables.detailMap(master, mapFactory(master.getRealm(), propertyName))

Parameters:
master -
propertyName -
Returns:
an observable map that tracks the map-type named property for the current value of the master observable value.
Since:
1.2

observeSet

public static IObservableSet observeSet(Realm realm,
                                        Object bean,
                                        String propertyName,
                                        Class elementType)
Returns an observable set in the given realm tracking the collection-typed named property of the given bean object. The returned set is mutable. When an item is added or removed the setter is invoked for the set on the parent bean to provide notification to other listeners via PropertyChangeEvents. This is done to provide the same behavior as is expected from arrays as specified in the bean spec in section 7.2.

Parameters:
realm - the realm
bean - the bean object
propertyName - the name of the property
elementType - type of the elements in the set. If null and the property is an array the type will be inferred. If null and the property type cannot be inferred element type will be null.
Returns:
an observable set tracking the collection-typed named property of the given bean object

observeSet

public static IObservableSet observeSet(Object bean,
                                        String propertyName,
                                        Class elementType)
Returns an observable set in the current default realm tracking the collection-typed named property of the given bean object. The returned set is mutable. When an item is added or removed the setter is invoked for the set on the parent bean to provide notification to other listeners via PropertyChangeEvents. This is done to provide the same behavior as is expected from arrays as specified in the bean spec in section 7.2.

Parameters:
bean - the bean object
propertyName - the name of the property
elementType - type of the elements in the set. If null and the property is an array the type will be inferred. If null and the property type cannot be inferred element type will be null.
Returns:
an observable set tracking the collection-typed named property of the given bean object
Since:
1.2

setFactory

public static IObservableFactory setFactory(Realm realm,
                                            String propertyName,
                                            Class elementType)
Returns a factory for creating observable sets in the given realm, tracking the given property of a particular bean object

Parameters:
realm - the realm to use
propertyName - the name of the property
elementType - type of the elements in the set. If null and the property is an array the type will be inferred. If null and the property type cannot be inferred element type will be null.
Returns:
a factory for creating observable sets in the given realm, tracking the given property of a particular bean object

setFactory

public static IObservableFactory setFactory(String propertyName,
                                            Class elementType)
Returns a factory for creating observable sets in the current default realm, tracking the given property of a particular bean object

Parameters:
propertyName - the name of the property
elementType - type of the elements in the set. If null and the property is an array the type will be inferred. If null and the property type cannot be inferred element type will be null.
Returns:
a factory for creating observable sets in the given realm, tracking the given property of a particular bean object
Since:
1.2

setToMapFactory

public static IObservableFactory setToMapFactory(Class beanClass,
                                                 String propertyName)
Returns a factory for creating an observable map. The factory, when provided with an IObservableSet, will create an IObservableMap in the same realm as the underlying set that tracks the current values of the named property for the beans in the given set.

Parameters:
beanClass - the common base type of bean objects that may be in the set
propertyName - the name of the property. May be nested e.g. "parent.name"
Returns:
a factory for creating IObservableMap objects
Since:
1.1

mapPropertyFactory

public static IObservableFactory mapPropertyFactory(Realm realm,
                                                    String propertyName)
Returns a factory for creating an observable map. The factory, when provided with a bean object, will create an IObservableMap in the given realm that tracks the map-typed named property for the specified bean.

Parameters:
realm - the realm assigned to observables created by the returned factory.
propertyName - the name of the property
Returns:
a factory for creating IObservableMap objects.
Since:
1.1

mapPropertyFactory

public static IObservableFactory mapPropertyFactory(String propertyName)
Returns a factory for creating an observable map. The factory, when provided with a bean object, will create an IObservableMap in the current default realm that tracks the map-typed named property for the specified bean.

Parameters:
propertyName - the name of the property
Returns:
a factory for creating IObservableMap objects.
Since:
1.2

Eclipse Platform
Release 3.6

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2010. All rights reserved.