PreferenceObject T  Class TIBCO Spotfire 6.0 API Reference
A preference object is a named value that can be stored on a user, group, and global level. Preference objects are managed through the PreferenceObjectService, using which new objects can be added, removed, and queried. The addition and removal of objects is, however, only available on a user (personal) level. Adding preference object to one or more groups is only available through the user interface of the application itself.

A preference object consists of a unique identification (a name) within its preference object class (see below), and the actual value. This means that two different users cannot create an object with the same name within the same preference object class.

The value type of a preference object is generic to reflect the type of the preference class it belongs to. To be able to persist preference objects, the value type must be serializable. In addition, it is also recommended for the type to be immutable, that is, it should not be possible to change the state of objects of that type through public property setters or methods.

Once added to the PreferenceObjectService, preference objects are fully managed by that service and synchronized with the server. If the Value of the preference object changes, the ValueChanged event is fired with a PreferenceObjectValueChangedEventArgs T  containing the previous and the new value. Through this event, the PreferenceObjectService can track changes and reflect them both locally and on the server. However, if the value type of the object is not immutable and its internal state changes, the event is not fired and the changes will not be detected by the manager. In such cases, it is absolutely necessary to explicitly requested for the changes to be persisted through a call to ApplyChanges T (PreferenceObject T ).

In some cases it is not possible to alter the value of a preference object. Whether or not the value of an object can be changed is reflected through the IsReadOnly property. Objects that are inherited from the group or those that are global are examples of read-only objects.

A group of (that is, one or more) preference objects belong to one preference class. One such class is globally identified through its name (a string), for example MyPreferenceObjects or Spotfire.Dxp.PreferenceObjects. Note that a preference class does not physically exist either locally or on the server. They are comparable to the concept of namespaces in .Net programming languages. All preference objects belonging to the same preference class must have the same value type T. This implies that classes should be logically named to hold preference objects for a well defined area.

It is possible to define default preference objects at group and application level. Such default objects are used as fallback objects, for example when searching a class (see Find T (String, T, PreferenceObjectIdentifier)).

Inheritance Hierarchy

System Object
  DedicatedThreadAccessible
    Spotfire.Dxp.Framework.Preferences PreferenceObject T 

Namespace: Spotfire.Dxp.Framework.Preferences
Assembly: Spotfire.Dxp.Framework (in Spotfire.Dxp.Framework.dll) Version: 13.19.7018.3940 (13.19.7018.3940)
Syntax

[SerializableAttribute]
[PersistenceVersionAttribute(1, 0)]
public sealed class PreferenceObject<T> : DedicatedThreadAccessible
Type Parameters

T
The type of the value that the preference object is to contain. The type must be serializable. In addition, it is recommended for the type to implement the Equals(Object) and to be immutable.
See Also