Eclipse Platform Release 3.7

## org.eclipse.core.databinding.observable.value
Class WritableValue

    java.lang.Object
      org.eclipse.core.databinding.observable.AbstractObservable
          org.eclipse.core.databinding.observable.value.AbstractObservableValue
              org.eclipse.core.databinding.observable.value.WritableValue

All Implemented Interfaces:
  IObservable, IObservableValue

    public class WritableValue

extends AbstractObservableValue

Mutable (writable) implementation of `IObservableValue` that will maintain a value and fire change events when the value changes.

This class is thread safe. All state accessing methods must be invoked from the `current realm`. Methods for adding and removing listeners may be invoked from any thread.

Since:
  1.0

Constructor Summary
`WritableValue()` Constructs a new instance with the default realm, a `null` value type, and a `null` value.
`WritableValue(Object initialValue, Object valueType)` Constructs a new instance with the default realm.
`WritableValue(Realm realm)` Constructs a new instance with the provided `realm`, a `null` value type, and a `null` initial value.
`WritableValue(Realm realm, Object initialValue, Object valueType)` Constructs a new instance.

Method Summary
`protected void` `addListener(Object listenerType, IObservablesListener listener)`
`protected Object` `clone()`
`Object` `doGetValue()`
`void` `doSetValue(Object value)` Template method for setting the value of the observable.
`protected void` `fireEvent(ObservableEvent event)`
`protected void` `firstListenerAdded()`
`Realm` `getRealm()`
`Object` `getValueType()` The value type of this observable value, or `null` if this observable value is untyped.
`protected boolean` `hasListeners()`
`protected void` `lastListenerRemoved()`
`protected void` `removeListener(Object listenerType, IObservablesListener listener)`
`static WritableValue` `withValueType(Object elementType)`

Methods inherited from class org.eclipse.core.databinding.observable.value.AbstractObservableValue
`addValueChangeListener, fireChange, fireValueChange, getValue, isStale, removeValueChangeListener, setValue`

Methods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
`addChangeListener, addDisposeListener, addStaleListener, checkRealm, dispose, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.eclipse.core.databinding.observable.IObservable
`addChangeListener, addDisposeListener, addStaleListener, dispose, getRealm, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener`

Constructor Detail

### WritableValue

    public WritableValue()

  Constructs a new instance with the default realm, a `null` value type, and a `null` value.

### WritableValue

    public WritableValue(Object initialValue,
                         Object valueType)

  Constructs a new instance with the default realm.

  Parameters:
    `initialValue` - can be `null`
    `valueType` - can be `null`

### WritableValue

    public WritableValue(Realm realm)

  Constructs a new instance with the provided `realm`, a `null` value type, and a `null` initial value.

  Parameters:
    `realm` -

### WritableValue

    public WritableValue(Realm realm,
                         Object initialValue,
                         Object valueType)

  Constructs a new instance.

  Parameters:
    `realm` -
    `initialValue` - can be `null`
    `valueType` - can be `null`

Method Detail

### doGetValue

    public Object doGetValue()

  Specified by:
    `doGetValue` in class `AbstractObservableValue`

### doSetValue

    public void doSetValue(Object value)

  Description copied from class: `AbstractObservableValue`
  Template method for setting the value of the observable. By default the method throws an `UnsupportedOperationException`.

  Overrides:
    `doSetValue` in class `AbstractObservableValue`
  Parameters:
    `value` - The value to set.

### getValueType

    public Object getValueType()

  Description copied from interface: `IObservableValue`
  The value type of this observable value, or `null` if this observable value is untyped.

  Returns:
    the value type, or `null</null>`

### withValueType

    public static WritableValue withValueType(Object elementType)

  Parameters:
    `elementType` - can be `null`
  Returns:
    new instance with the default realm and a value of `null`

### addListener

    protected void addListener(Object listenerType,
                               IObservablesListener listener)

  Parameters:
    `listenerType` -
    `listener` -

### removeListener

    protected void removeListener(Object listenerType,
                                  IObservablesListener listener)

  Parameters:
    `listenerType` -
    `listener` -

### hasListeners

    protected boolean hasListeners()

### fireEvent

    protected void fireEvent(ObservableEvent event)

### firstListenerAdded

    protected void firstListenerAdded()

### lastListenerRemoved

    protected void lastListenerRemoved()

### getRealm

    public Realm getRealm()

  Returns:
    Returns the realm.

### clone

    protected Object clone()
                    throws CloneNotSupportedException

  Overrides:
    `clone` in class `Object`
  Throws:
    `CloneNotSupportedException`

Eclipse Platform Release 3.7

Guidelines for using Eclipse APIs.

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