1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.nuiton.validator.xwork2.field;
23
24 import java.beans.PropertyChangeListener;
25 import java.beans.PropertyChangeSupport;
26
27
28
29
30 public class FieldExpressionBean {
31
32 protected final PropertyChangeSupport p;
33
34 protected boolean booleanValue;
35
36 protected short shortValue;
37
38 protected int intValue;
39
40 protected long longValue;
41
42 protected double doubleValue;
43
44 protected String stringValue;
45
46 public FieldExpressionBean() {
47 p = new PropertyChangeSupport(this);
48 }
49
50 public boolean isBooleanValue() {
51 return booleanValue;
52 }
53
54 public double getDoubleValue() {
55 return doubleValue;
56 }
57
58 public int getIntValue() {
59 return intValue;
60 }
61
62 public long getLongValue() {
63 return longValue;
64 }
65
66 public short getShortValue() {
67 return shortValue;
68 }
69
70 public String getStringValue() {
71 return stringValue;
72 }
73
74 public void setBooleanValue(boolean newValue) {
75 Object oldValue = booleanValue;
76 booleanValue = newValue;
77 firePropertyChange("booleanValue", oldValue, newValue);
78 }
79
80 public void setDoubleValue(double newValue) {
81 Object oldValue = doubleValue;
82 doubleValue = newValue;
83 firePropertyChange("doubleValue", oldValue, newValue);
84 }
85
86 public void setIntValue(int newValue) {
87 Object oldValue = stringValue;
88 intValue = newValue;
89 firePropertyChange("intValue", oldValue, newValue);
90 }
91
92 public void setLongValue(long newValue) {
93 Object oldValue = longValue;
94 longValue = newValue;
95 firePropertyChange("longValue", oldValue, newValue);
96 }
97
98 public void setShortValue(short newValue) {
99 Object oldValue = shortValue;
100 shortValue = newValue;
101 firePropertyChange("shortValue", oldValue, newValue);
102 }
103
104 public void setStringValue(String newValue) {
105 Object oldValue = stringValue;
106 stringValue = newValue;
107 firePropertyChange("stringValue", oldValue, newValue);
108 }
109
110 protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
111 p.firePropertyChange(propertyName, oldValue, newValue);
112 }
113
114 public void addPropertyChangeListener(PropertyChangeListener listener) {
115 p.addPropertyChangeListener(listener);
116 }
117
118 public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
119 p.addPropertyChangeListener(propertyName, listener);
120 }
121
122 public void removePropertyChangeListener(PropertyChangeListener listener) {
123 p.removePropertyChangeListener(listener);
124 }
125
126 public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
127 p.removePropertyChangeListener(propertyName, listener);
128 }
129 }