1
2
3
4
5
6
7 package BusinessDomainDsl.impl;
8
9 import BusinessDomainDsl.BusinessDomainDslPackage;
10 import BusinessDomainDsl.StringProperty;
11
12 import org.eclipse.emf.common.notify.Notification;
13
14 import org.eclipse.emf.ecore.EClass;
15
16 import org.eclipse.emf.ecore.impl.ENotificationImpl;
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 public class StringPropertyImpl extends PropertyImpl implements StringProperty {
35
36
37
38
39
40
41
42
43 protected static final String REGULAR_EXPRESSION_EDEFAULT = null;
44
45
46
47
48
49
50
51
52
53 protected String regularExpression = REGULAR_EXPRESSION_EDEFAULT;
54
55
56
57
58
59
60
61
62
63 protected static final int MIN_LENGTH_EDEFAULT = -1;
64
65
66
67
68
69
70
71
72
73 protected int minLength = MIN_LENGTH_EDEFAULT;
74
75
76
77
78
79
80
81
82
83 protected static final int MAX_LENGTH_EDEFAULT = -1;
84
85
86
87
88
89
90
91
92
93 protected int maxLength = MAX_LENGTH_EDEFAULT;
94
95
96
97
98
99
100
101
102
103 protected static final String DEFAULT_VALUE_EDEFAULT = null;
104
105
106
107
108
109
110
111
112
113 protected String defaultValue = DEFAULT_VALUE_EDEFAULT;
114
115
116
117
118
119
120 protected StringPropertyImpl() {
121 super();
122 }
123
124
125
126
127
128
129 @Override
130 protected EClass eStaticClass() {
131 return BusinessDomainDslPackage.Literals.STRING_PROPERTY;
132 }
133
134
135
136
137
138
139 public String getRegularExpression() {
140 return regularExpression;
141 }
142
143
144
145
146
147
148 public void setRegularExpression(String newRegularExpression) {
149 String oldRegularExpression = regularExpression;
150 regularExpression = newRegularExpression;
151 if (eNotificationRequired())
152 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.STRING_PROPERTY__REGULAR_EXPRESSION, oldRegularExpression, regularExpression));
153 }
154
155
156
157
158
159
160 public int getMinLength() {
161 return minLength;
162 }
163
164
165
166
167
168
169 public void setMinLength(int newMinLength) {
170 int oldMinLength = minLength;
171 minLength = newMinLength;
172 if (eNotificationRequired())
173 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.STRING_PROPERTY__MIN_LENGTH, oldMinLength, minLength));
174 }
175
176
177
178
179
180
181 public int getMaxLength() {
182 return maxLength;
183 }
184
185
186
187
188
189
190 public void setMaxLength(int newMaxLength) {
191 int oldMaxLength = maxLength;
192 maxLength = newMaxLength;
193 if (eNotificationRequired())
194 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.STRING_PROPERTY__MAX_LENGTH, oldMaxLength, maxLength));
195 }
196
197
198
199
200
201
202 public String getDefaultValue() {
203 return defaultValue;
204 }
205
206
207
208
209
210
211 public void setDefaultValue(String newDefaultValue) {
212 String oldDefaultValue = defaultValue;
213 defaultValue = newDefaultValue;
214 if (eNotificationRequired())
215 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.STRING_PROPERTY__DEFAULT_VALUE, oldDefaultValue, defaultValue));
216 }
217
218
219
220
221
222
223 @Override
224 public Object eGet(int featureID, boolean resolve, boolean coreType) {
225 switch (featureID) {
226 case BusinessDomainDslPackage.STRING_PROPERTY__REGULAR_EXPRESSION:
227 return getRegularExpression();
228 case BusinessDomainDslPackage.STRING_PROPERTY__MIN_LENGTH:
229 return getMinLength();
230 case BusinessDomainDslPackage.STRING_PROPERTY__MAX_LENGTH:
231 return getMaxLength();
232 case BusinessDomainDslPackage.STRING_PROPERTY__DEFAULT_VALUE:
233 return getDefaultValue();
234 }
235 return super.eGet(featureID, resolve, coreType);
236 }
237
238
239
240
241
242
243 @Override
244 public void eSet(int featureID, Object newValue) {
245 switch (featureID) {
246 case BusinessDomainDslPackage.STRING_PROPERTY__REGULAR_EXPRESSION:
247 setRegularExpression((String)newValue);
248 return;
249 case BusinessDomainDslPackage.STRING_PROPERTY__MIN_LENGTH:
250 setMinLength((Integer)newValue);
251 return;
252 case BusinessDomainDslPackage.STRING_PROPERTY__MAX_LENGTH:
253 setMaxLength((Integer)newValue);
254 return;
255 case BusinessDomainDslPackage.STRING_PROPERTY__DEFAULT_VALUE:
256 setDefaultValue((String)newValue);
257 return;
258 }
259 super.eSet(featureID, newValue);
260 }
261
262
263
264
265
266
267 @Override
268 public void eUnset(int featureID) {
269 switch (featureID) {
270 case BusinessDomainDslPackage.STRING_PROPERTY__REGULAR_EXPRESSION:
271 setRegularExpression(REGULAR_EXPRESSION_EDEFAULT);
272 return;
273 case BusinessDomainDslPackage.STRING_PROPERTY__MIN_LENGTH:
274 setMinLength(MIN_LENGTH_EDEFAULT);
275 return;
276 case BusinessDomainDslPackage.STRING_PROPERTY__MAX_LENGTH:
277 setMaxLength(MAX_LENGTH_EDEFAULT);
278 return;
279 case BusinessDomainDslPackage.STRING_PROPERTY__DEFAULT_VALUE:
280 setDefaultValue(DEFAULT_VALUE_EDEFAULT);
281 return;
282 }
283 super.eUnset(featureID);
284 }
285
286
287
288
289
290
291 @Override
292 public boolean eIsSet(int featureID) {
293 switch (featureID) {
294 case BusinessDomainDslPackage.STRING_PROPERTY__REGULAR_EXPRESSION:
295 return REGULAR_EXPRESSION_EDEFAULT == null ? regularExpression != null : !REGULAR_EXPRESSION_EDEFAULT.equals(regularExpression);
296 case BusinessDomainDslPackage.STRING_PROPERTY__MIN_LENGTH:
297 return minLength != MIN_LENGTH_EDEFAULT;
298 case BusinessDomainDslPackage.STRING_PROPERTY__MAX_LENGTH:
299 return maxLength != MAX_LENGTH_EDEFAULT;
300 case BusinessDomainDslPackage.STRING_PROPERTY__DEFAULT_VALUE:
301 return DEFAULT_VALUE_EDEFAULT == null ? defaultValue != null : !DEFAULT_VALUE_EDEFAULT.equals(defaultValue);
302 }
303 return super.eIsSet(featureID);
304 }
305
306
307
308
309
310
311 @Override
312 public String toString() {
313 if (eIsProxy()) return super.toString();
314
315 StringBuffer result = new StringBuffer(super.toString());
316 result.append(" (regularExpression: ");
317 result.append(regularExpression);
318 result.append(", minLength: ");
319 result.append(minLength);
320 result.append(", maxLength: ");
321 result.append(maxLength);
322 result.append(", defaultValue: ");
323 result.append(defaultValue);
324 result.append(')');
325 return result.toString();
326 }
327
328 }