1
2
3
4
5
6
7 package org.mod4j.dsl.datacontract.mm.DataContractDsl.impl;
8
9 import org.eclipse.emf.common.notify.Notification;
10
11 import org.eclipse.emf.ecore.EClass;
12 import org.eclipse.emf.ecore.InternalEObject;
13
14 import org.eclipse.emf.ecore.impl.ENotificationImpl;
15
16 import org.mod4j.dsl.datacontract.mm.DataContractDsl.DataContractDslPackage;
17 import org.mod4j.dsl.datacontract.mm.DataContractDsl.Dto;
18 import org.mod4j.dsl.datacontract.mm.DataContractDsl.DtoAssociationRoleProperty;
19 import org.mod4j.dsl.datacontract.mm.DataContractDsl.Multiplicity;
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 public class DtoAssociationRolePropertyImpl extends DtoPropertyImpl implements DtoAssociationRoleProperty {
37
38
39
40
41
42
43
44
45 protected Dto dtoType;
46
47
48
49
50
51
52
53
54
55 protected static final boolean ORDERED_EDEFAULT = false;
56
57
58
59
60
61
62
63
64
65 protected boolean ordered = ORDERED_EDEFAULT;
66
67
68
69
70
71
72
73
74
75 protected static final Multiplicity MULTIPLICITY_EDEFAULT = Multiplicity.ONE;
76
77
78
79
80
81
82
83
84
85 protected Multiplicity multiplicity = MULTIPLICITY_EDEFAULT;
86
87
88
89
90
91
92 protected DtoAssociationRolePropertyImpl() {
93 super();
94 }
95
96
97
98
99
100
101 @Override
102 protected EClass eStaticClass() {
103 return DataContractDslPackage.Literals.DTO_ASSOCIATION_ROLE_PROPERTY;
104 }
105
106
107
108
109
110
111 public Dto getDtoType() {
112 if (dtoType != null && dtoType.eIsProxy()) {
113 InternalEObject oldDtoType = (InternalEObject)dtoType;
114 dtoType = (Dto)eResolveProxy(oldDtoType);
115 if (dtoType != oldDtoType) {
116 if (eNotificationRequired())
117 eNotify(new ENotificationImpl(this, Notification.RESOLVE, DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__DTO_TYPE, oldDtoType, dtoType));
118 }
119 }
120 return dtoType;
121 }
122
123
124
125
126
127
128 public Dto basicGetDtoType() {
129 return dtoType;
130 }
131
132
133
134
135
136
137 public void setDtoType(Dto newDtoType) {
138 Dto oldDtoType = dtoType;
139 dtoType = newDtoType;
140 if (eNotificationRequired())
141 eNotify(new ENotificationImpl(this, Notification.SET, DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__DTO_TYPE, oldDtoType, dtoType));
142 }
143
144
145
146
147
148
149 public boolean isOrdered() {
150 return ordered;
151 }
152
153
154
155
156
157
158 public void setOrdered(boolean newOrdered) {
159 boolean oldOrdered = ordered;
160 ordered = newOrdered;
161 if (eNotificationRequired())
162 eNotify(new ENotificationImpl(this, Notification.SET, DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__ORDERED, oldOrdered, ordered));
163 }
164
165
166
167
168
169
170 public Multiplicity getMultiplicity() {
171 return multiplicity;
172 }
173
174
175
176
177
178
179 public void setMultiplicity(Multiplicity newMultiplicity) {
180 Multiplicity oldMultiplicity = multiplicity;
181 multiplicity = newMultiplicity == null ? MULTIPLICITY_EDEFAULT : newMultiplicity;
182 if (eNotificationRequired())
183 eNotify(new ENotificationImpl(this, Notification.SET, DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__MULTIPLICITY, oldMultiplicity, multiplicity));
184 }
185
186
187
188
189
190
191 @Override
192 public Object eGet(int featureID, boolean resolve, boolean coreType) {
193 switch (featureID) {
194 case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__DTO_TYPE:
195 if (resolve) return getDtoType();
196 return basicGetDtoType();
197 case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__ORDERED:
198 return isOrdered();
199 case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__MULTIPLICITY:
200 return getMultiplicity();
201 }
202 return super.eGet(featureID, resolve, coreType);
203 }
204
205
206
207
208
209
210 @Override
211 public void eSet(int featureID, Object newValue) {
212 switch (featureID) {
213 case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__DTO_TYPE:
214 setDtoType((Dto)newValue);
215 return;
216 case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__ORDERED:
217 setOrdered((Boolean)newValue);
218 return;
219 case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__MULTIPLICITY:
220 setMultiplicity((Multiplicity)newValue);
221 return;
222 }
223 super.eSet(featureID, newValue);
224 }
225
226
227
228
229
230
231 @Override
232 public void eUnset(int featureID) {
233 switch (featureID) {
234 case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__DTO_TYPE:
235 setDtoType((Dto)null);
236 return;
237 case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__ORDERED:
238 setOrdered(ORDERED_EDEFAULT);
239 return;
240 case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__MULTIPLICITY:
241 setMultiplicity(MULTIPLICITY_EDEFAULT);
242 return;
243 }
244 super.eUnset(featureID);
245 }
246
247
248
249
250
251
252 @Override
253 public boolean eIsSet(int featureID) {
254 switch (featureID) {
255 case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__DTO_TYPE:
256 return dtoType != null;
257 case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__ORDERED:
258 return ordered != ORDERED_EDEFAULT;
259 case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__MULTIPLICITY:
260 return multiplicity != MULTIPLICITY_EDEFAULT;
261 }
262 return super.eIsSet(featureID);
263 }
264
265
266
267
268
269
270 @Override
271 public String toString() {
272 if (eIsProxy()) return super.toString();
273
274 StringBuffer result = new StringBuffer(super.toString());
275 result.append(" (ordered: ");
276 result.append(ordered);
277 result.append(", multiplicity: ");
278 result.append(multiplicity);
279 result.append(')');
280 return result.toString();
281 }
282
283 }