1 17 package org.eclipse.emf.mapping.impl; 18 19 20 import java.util.Collection ; 21 22 import org.eclipse.emf.common.notify.Notification; 23 import org.eclipse.emf.common.notify.NotificationChain; 24 import org.eclipse.emf.ecore.EClass; 25 import org.eclipse.emf.ecore.EObject; 26 import org.eclipse.emf.ecore.EStructuralFeature; 27 import org.eclipse.emf.ecore.InternalEObject; 28 import org.eclipse.emf.ecore.impl.ENotificationImpl; 29 import org.eclipse.emf.ecore.util.InternalEList; 30 import org.eclipse.emf.mapping.ComplexTypeConverter; 31 import org.eclipse.emf.mapping.Mapping; 32 import org.eclipse.emf.mapping.MappingHelper; 33 import org.eclipse.emf.mapping.MappingPackage; 34 35 36 50 public class ComplexTypeConverterImpl extends TypeConverterImpl implements ComplexTypeConverter 51 { 52 60 protected Mapping in2out = null; 61 62 70 protected Mapping out2in = null; 71 72 77 protected ComplexTypeConverterImpl() 78 { 79 super(); 80 } 81 82 87 protected EClass eStaticClass() 88 { 89 return MappingPackage.eINSTANCE.getComplexTypeConverter(); 90 } 91 92 97 public Mapping getIn2out() 98 { 99 if (in2out != null && in2out.eIsProxy()) 100 { 101 Mapping oldIn2out = in2out; 102 in2out = (Mapping)eResolveProxy((InternalEObject)in2out); 103 if (in2out != oldIn2out) 104 { 105 if (eNotificationRequired()) 106 eNotify(new ENotificationImpl(this, Notification.RESOLVE, MappingPackage.COMPLEX_TYPE_CONVERTER__IN2OUT, oldIn2out, in2out)); 107 } 108 } 109 return in2out; 110 } 111 112 117 public Mapping basicGetIn2out() 118 { 119 return in2out; 120 } 121 122 127 public void setIn2out(Mapping newIn2out) 128 { 129 Mapping oldIn2out = in2out; 130 in2out = newIn2out; 131 if (eNotificationRequired()) 132 eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.COMPLEX_TYPE_CONVERTER__IN2OUT, oldIn2out, in2out)); 133 } 134 135 140 public Mapping getOut2in() 141 { 142 if (out2in != null && out2in.eIsProxy()) 143 { 144 Mapping oldOut2in = out2in; 145 out2in = (Mapping)eResolveProxy((InternalEObject)out2in); 146 if (out2in != oldOut2in) 147 { 148 if (eNotificationRequired()) 149 eNotify(new ENotificationImpl(this, Notification.RESOLVE, MappingPackage.COMPLEX_TYPE_CONVERTER__OUT2IN, oldOut2in, out2in)); 150 } 151 } 152 return out2in; 153 } 154 155 160 public Mapping basicGetOut2in() 161 { 162 return out2in; 163 } 164 165 170 public void setOut2in(Mapping newOut2in) 171 { 172 Mapping oldOut2in = out2in; 173 out2in = newOut2in; 174 if (eNotificationRequired()) 175 eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.COMPLEX_TYPE_CONVERTER__OUT2IN, oldOut2in, out2in)); 176 } 177 178 183 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 184 { 185 if (featureID >= 0) 186 { 187 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 188 { 189 case MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER: 190 if (eContainer != null) 191 msgs = eBasicRemoveFromContainer(msgs); 192 return eBasicSetContainer(otherEnd, MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER, msgs); 193 case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN: 194 if (eContainer != null) 195 msgs = eBasicRemoveFromContainer(msgs); 196 return eBasicSetContainer(otherEnd, MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN, msgs); 197 case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED: 198 return ((InternalEList)getNested()).basicAdd(otherEnd, msgs); 199 default: 200 return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); 201 } 202 } 203 if (eContainer != null) 204 msgs = eBasicRemoveFromContainer(msgs); 205 return eBasicSetContainer(otherEnd, featureID, msgs); 206 } 207 208 213 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 214 { 215 if (featureID >= 0) 216 { 217 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 218 { 219 case MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER: 220 return eBasicSetContainer(null, MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER, msgs); 221 case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN: 222 return eBasicSetContainer(null, MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN, msgs); 223 case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED: 224 return ((InternalEList)getNested()).basicRemove(otherEnd, msgs); 225 default: 226 return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); 227 } 228 } 229 return eBasicSetContainer(null, featureID, msgs); 230 } 231 232 237 public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) 238 { 239 if (eContainerFeatureID >= 0) 240 { 241 switch (eContainerFeatureID) 242 { 243 case MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER: 244 return eContainer.eInverseRemove(this, MappingPackage.MAPPING__HELPER, Mapping.class, msgs); 245 case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN: 246 return eContainer.eInverseRemove(this, MappingPackage.MAPPING_HELPER__NESTED, MappingHelper.class, msgs); 247 default: 248 return eDynamicBasicRemoveFromContainer(msgs); 249 } 250 } 251 return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); 252 } 253 254 259 public Object eGet(EStructuralFeature eFeature, boolean resolve) 260 { 261 switch (eDerivedStructuralFeatureID(eFeature)) 262 { 263 case MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER: 264 return getMapper(); 265 case MappingPackage.COMPLEX_TYPE_CONVERTER__HELPED_OBJECT: 266 if (resolve) return getHelpedObject(); 267 return basicGetHelpedObject(); 268 case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN: 269 return getNestedIn(); 270 case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED: 271 return getNested(); 272 case MappingPackage.COMPLEX_TYPE_CONVERTER__IN2OUT: 273 if (resolve) return getIn2out(); 274 return basicGetIn2out(); 275 case MappingPackage.COMPLEX_TYPE_CONVERTER__OUT2IN: 276 if (resolve) return getOut2in(); 277 return basicGetOut2in(); 278 } 279 return eDynamicGet(eFeature, resolve); 280 } 281 282 287 public void eSet(EStructuralFeature eFeature, Object newValue) 288 { 289 switch (eDerivedStructuralFeatureID(eFeature)) 290 { 291 case MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER: 292 setMapper((Mapping)newValue); 293 return; 294 case MappingPackage.COMPLEX_TYPE_CONVERTER__HELPED_OBJECT: 295 setHelpedObject((EObject)newValue); 296 return; 297 case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN: 298 setNestedIn((MappingHelper)newValue); 299 return; 300 case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED: 301 getNested().clear(); 302 getNested().addAll((Collection )newValue); 303 return; 304 case MappingPackage.COMPLEX_TYPE_CONVERTER__IN2OUT: 305 setIn2out((Mapping)newValue); 306 return; 307 case MappingPackage.COMPLEX_TYPE_CONVERTER__OUT2IN: 308 setOut2in((Mapping)newValue); 309 return; 310 } 311 eDynamicSet(eFeature, newValue); 312 } 313 314 319 public void eUnset(EStructuralFeature eFeature) 320 { 321 switch (eDerivedStructuralFeatureID(eFeature)) 322 { 323 case MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER: 324 setMapper((Mapping)null); 325 return; 326 case MappingPackage.COMPLEX_TYPE_CONVERTER__HELPED_OBJECT: 327 setHelpedObject((EObject)null); 328 return; 329 case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN: 330 setNestedIn((MappingHelper)null); 331 return; 332 case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED: 333 getNested().clear(); 334 return; 335 case MappingPackage.COMPLEX_TYPE_CONVERTER__IN2OUT: 336 setIn2out((Mapping)null); 337 return; 338 case MappingPackage.COMPLEX_TYPE_CONVERTER__OUT2IN: 339 setOut2in((Mapping)null); 340 return; 341 } 342 eDynamicUnset(eFeature); 343 } 344 345 350 public boolean eIsSet(EStructuralFeature eFeature) 351 { 352 switch (eDerivedStructuralFeatureID(eFeature)) 353 { 354 case MappingPackage.COMPLEX_TYPE_CONVERTER__MAPPER: 355 return getMapper() != null; 356 case MappingPackage.COMPLEX_TYPE_CONVERTER__HELPED_OBJECT: 357 return helpedObject != null; 358 case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED_IN: 359 return getNestedIn() != null; 360 case MappingPackage.COMPLEX_TYPE_CONVERTER__NESTED: 361 return nested != null && !nested.isEmpty(); 362 case MappingPackage.COMPLEX_TYPE_CONVERTER__IN2OUT: 363 return in2out != null; 364 case MappingPackage.COMPLEX_TYPE_CONVERTER__OUT2IN: 365 return out2in != null; 366 } 367 return eDynamicIsSet(eFeature); 368 } 369 370 } | Popular Tags |