KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > internal > databinding > provisional > observable > value > WritableValue


1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  ******************************************************************************/

11
12 package org.eclipse.jface.internal.databinding.provisional.observable.value;
13
14 import org.eclipse.jface.internal.databinding.provisional.observable.Diffs;
15
16 /**
17  * @since 1.0
18  *
19  */

20 public class WritableValue extends AbstractObservableValue {
21
22     private final Object JavaDoc valueType;
23
24     /**
25      * @param initialValue
26      */

27     public WritableValue(Object JavaDoc initialValue) {
28         this(null, initialValue);
29     }
30
31     /**
32      * @param type
33      */

34     public WritableValue(Class JavaDoc type) {
35         this(type, null);
36     }
37
38     /**
39      * @param valueType
40      * @param initialValue
41      */

42     public WritableValue(Object JavaDoc valueType, Object JavaDoc initialValue) {
43         this.valueType = valueType;
44         this.value = initialValue;
45     }
46
47     private Object JavaDoc value = null;
48
49     public Object JavaDoc doGetValue() {
50         return value;
51     }
52
53     /**
54      * @param value
55      * The value to set.
56      */

57     public void setValue(Object JavaDoc value) {
58         fireValueChange(Diffs.createValueDiff(this.value, this.value = value));
59     }
60
61     public Object JavaDoc getValueType() {
62         return valueType;
63     }
64
65 }
66
Popular Tags