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 import org.eclipse.emf.common.notify.NotificationChain;
11
12 import org.eclipse.emf.ecore.EClass;
13 import org.eclipse.emf.ecore.InternalEObject;
14
15 import org.eclipse.emf.ecore.impl.ENotificationImpl;
16
17 import org.eclipse.emf.ecore.util.EcoreUtil;
18
19 import org.mod4j.dsl.datacontract.mm.DataContractDsl.DataContractDslPackage;
20 import org.mod4j.dsl.datacontract.mm.DataContractDsl.DataContractModel;
21 import org.mod4j.dsl.datacontract.mm.DataContractDsl.Dto;
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 public class DtoImpl extends ModelElementImpl implements Dto {
37
38
39
40
41
42 protected DtoImpl() {
43 super();
44 }
45
46
47
48
49
50
51 @Override
52 protected EClass eStaticClass() {
53 return DataContractDslPackage.Literals.DTO;
54 }
55
56
57
58
59
60
61 public DataContractModel getDatacontractModel() {
62 if (eContainerFeatureID() != DataContractDslPackage.DTO__DATACONTRACT_MODEL) return null;
63 return (DataContractModel)eContainer();
64 }
65
66
67
68
69
70
71 public NotificationChain basicSetDatacontractModel(DataContractModel newDatacontractModel, NotificationChain msgs) {
72 msgs = eBasicSetContainer((InternalEObject)newDatacontractModel, DataContractDslPackage.DTO__DATACONTRACT_MODEL, msgs);
73 return msgs;
74 }
75
76
77
78
79
80
81 public void setDatacontractModel(DataContractModel newDatacontractModel) {
82 if (newDatacontractModel != eInternalContainer() || (eContainerFeatureID() != DataContractDslPackage.DTO__DATACONTRACT_MODEL && newDatacontractModel != null)) {
83 if (EcoreUtil.isAncestor(this, newDatacontractModel))
84 throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
85 NotificationChain msgs = null;
86 if (eInternalContainer() != null)
87 msgs = eBasicRemoveFromContainer(msgs);
88 if (newDatacontractModel != null)
89 msgs = ((InternalEObject)newDatacontractModel).eInverseAdd(this, DataContractDslPackage.DATA_CONTRACT_MODEL__DTOS, DataContractModel.class, msgs);
90 msgs = basicSetDatacontractModel(newDatacontractModel, msgs);
91 if (msgs != null) msgs.dispatch();
92 }
93 else if (eNotificationRequired())
94 eNotify(new ENotificationImpl(this, Notification.SET, DataContractDslPackage.DTO__DATACONTRACT_MODEL, newDatacontractModel, newDatacontractModel));
95 }
96
97
98
99
100
101
102 @Override
103 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
104 switch (featureID) {
105 case DataContractDslPackage.DTO__DATACONTRACT_MODEL:
106 if (eInternalContainer() != null)
107 msgs = eBasicRemoveFromContainer(msgs);
108 return basicSetDatacontractModel((DataContractModel)otherEnd, msgs);
109 }
110 return super.eInverseAdd(otherEnd, featureID, msgs);
111 }
112
113
114
115
116
117
118 @Override
119 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
120 switch (featureID) {
121 case DataContractDslPackage.DTO__DATACONTRACT_MODEL:
122 return basicSetDatacontractModel(null, msgs);
123 }
124 return super.eInverseRemove(otherEnd, featureID, msgs);
125 }
126
127
128
129
130
131
132 @Override
133 public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
134 switch (eContainerFeatureID()) {
135 case DataContractDslPackage.DTO__DATACONTRACT_MODEL:
136 return eInternalContainer().eInverseRemove(this, DataContractDslPackage.DATA_CONTRACT_MODEL__DTOS, DataContractModel.class, msgs);
137 }
138 return super.eBasicRemoveFromContainerFeature(msgs);
139 }
140
141
142
143
144
145
146 @Override
147 public Object eGet(int featureID, boolean resolve, boolean coreType) {
148 switch (featureID) {
149 case DataContractDslPackage.DTO__DATACONTRACT_MODEL:
150 return getDatacontractModel();
151 }
152 return super.eGet(featureID, resolve, coreType);
153 }
154
155
156
157
158
159
160 @Override
161 public void eSet(int featureID, Object newValue) {
162 switch (featureID) {
163 case DataContractDslPackage.DTO__DATACONTRACT_MODEL:
164 setDatacontractModel((DataContractModel)newValue);
165 return;
166 }
167 super.eSet(featureID, newValue);
168 }
169
170
171
172
173
174
175 @Override
176 public void eUnset(int featureID) {
177 switch (featureID) {
178 case DataContractDslPackage.DTO__DATACONTRACT_MODEL:
179 setDatacontractModel((DataContractModel)null);
180 return;
181 }
182 super.eUnset(featureID);
183 }
184
185
186
187
188
189
190 @Override
191 public boolean eIsSet(int featureID) {
192 switch (featureID) {
193 case DataContractDslPackage.DTO__DATACONTRACT_MODEL:
194 return getDatacontractModel() != null;
195 }
196 return super.eIsSet(featureID);
197 }
198
199 }