1 17 package org.eclipse.emf.mapping.impl; 18 19 20 import java.util.Collection ; 21 22 import org.eclipse.emf.common.notify.NotificationChain; 23 import org.eclipse.emf.ecore.EClass; 24 import org.eclipse.emf.ecore.EObject; 25 import org.eclipse.emf.ecore.EStructuralFeature; 26 import org.eclipse.emf.ecore.InternalEObject; 27 import org.eclipse.emf.ecore.util.InternalEList; 28 import org.eclipse.emf.mapping.Mapping; 29 import org.eclipse.emf.mapping.MappingHelper; 30 import org.eclipse.emf.mapping.MappingPackage; 31 import org.eclipse.emf.mapping.TypeConverter; 32 33 34 43 public class TypeConverterImpl extends MappingHelperImpl implements TypeConverter 44 { 45 50 protected TypeConverterImpl() 51 { 52 super(); 53 } 54 55 60 protected EClass eStaticClass() 61 { 62 return MappingPackage.eINSTANCE.getTypeConverter(); 63 } 64 65 70 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 71 { 72 if (featureID >= 0) 73 { 74 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 75 { 76 case MappingPackage.TYPE_CONVERTER__MAPPER: 77 if (eContainer != null) 78 msgs = eBasicRemoveFromContainer(msgs); 79 return eBasicSetContainer(otherEnd, MappingPackage.TYPE_CONVERTER__MAPPER, msgs); 80 case MappingPackage.TYPE_CONVERTER__NESTED_IN: 81 if (eContainer != null) 82 msgs = eBasicRemoveFromContainer(msgs); 83 return eBasicSetContainer(otherEnd, MappingPackage.TYPE_CONVERTER__NESTED_IN, msgs); 84 case MappingPackage.TYPE_CONVERTER__NESTED: 85 return ((InternalEList)getNested()).basicAdd(otherEnd, msgs); 86 default: 87 return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); 88 } 89 } 90 if (eContainer != null) 91 msgs = eBasicRemoveFromContainer(msgs); 92 return eBasicSetContainer(otherEnd, featureID, msgs); 93 } 94 95 100 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 101 { 102 if (featureID >= 0) 103 { 104 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 105 { 106 case MappingPackage.TYPE_CONVERTER__MAPPER: 107 return eBasicSetContainer(null, MappingPackage.TYPE_CONVERTER__MAPPER, msgs); 108 case MappingPackage.TYPE_CONVERTER__NESTED_IN: 109 return eBasicSetContainer(null, MappingPackage.TYPE_CONVERTER__NESTED_IN, msgs); 110 case MappingPackage.TYPE_CONVERTER__NESTED: 111 return ((InternalEList)getNested()).basicRemove(otherEnd, msgs); 112 default: 113 return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); 114 } 115 } 116 return eBasicSetContainer(null, featureID, msgs); 117 } 118 119 124 public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) 125 { 126 if (eContainerFeatureID >= 0) 127 { 128 switch (eContainerFeatureID) 129 { 130 case MappingPackage.TYPE_CONVERTER__MAPPER: 131 return eContainer.eInverseRemove(this, MappingPackage.MAPPING__HELPER, Mapping.class, msgs); 132 case MappingPackage.TYPE_CONVERTER__NESTED_IN: 133 return eContainer.eInverseRemove(this, MappingPackage.MAPPING_HELPER__NESTED, MappingHelper.class, msgs); 134 default: 135 return eDynamicBasicRemoveFromContainer(msgs); 136 } 137 } 138 return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); 139 } 140 141 146 public Object eGet(EStructuralFeature eFeature, boolean resolve) 147 { 148 switch (eDerivedStructuralFeatureID(eFeature)) 149 { 150 case MappingPackage.TYPE_CONVERTER__MAPPER: 151 return getMapper(); 152 case MappingPackage.TYPE_CONVERTER__HELPED_OBJECT: 153 if (resolve) return getHelpedObject(); 154 return basicGetHelpedObject(); 155 case MappingPackage.TYPE_CONVERTER__NESTED_IN: 156 return getNestedIn(); 157 case MappingPackage.TYPE_CONVERTER__NESTED: 158 return getNested(); 159 } 160 return eDynamicGet(eFeature, resolve); 161 } 162 163 168 public void eSet(EStructuralFeature eFeature, Object newValue) 169 { 170 switch (eDerivedStructuralFeatureID(eFeature)) 171 { 172 case MappingPackage.TYPE_CONVERTER__MAPPER: 173 setMapper((Mapping)newValue); 174 return; 175 case MappingPackage.TYPE_CONVERTER__HELPED_OBJECT: 176 setHelpedObject((EObject)newValue); 177 return; 178 case MappingPackage.TYPE_CONVERTER__NESTED_IN: 179 setNestedIn((MappingHelper)newValue); 180 return; 181 case MappingPackage.TYPE_CONVERTER__NESTED: 182 getNested().clear(); 183 getNested().addAll((Collection )newValue); 184 return; 185 } 186 eDynamicSet(eFeature, newValue); 187 } 188 189 194 public void eUnset(EStructuralFeature eFeature) 195 { 196 switch (eDerivedStructuralFeatureID(eFeature)) 197 { 198 case MappingPackage.TYPE_CONVERTER__MAPPER: 199 setMapper((Mapping)null); 200 return; 201 case MappingPackage.TYPE_CONVERTER__HELPED_OBJECT: 202 setHelpedObject((EObject)null); 203 return; 204 case MappingPackage.TYPE_CONVERTER__NESTED_IN: 205 setNestedIn((MappingHelper)null); 206 return; 207 case MappingPackage.TYPE_CONVERTER__NESTED: 208 getNested().clear(); 209 return; 210 } 211 eDynamicUnset(eFeature); 212 } 213 214 219 public boolean eIsSet(EStructuralFeature eFeature) 220 { 221 switch (eDerivedStructuralFeatureID(eFeature)) 222 { 223 case MappingPackage.TYPE_CONVERTER__MAPPER: 224 return getMapper() != null; 225 case MappingPackage.TYPE_CONVERTER__HELPED_OBJECT: 226 return helpedObject != null; 227 case MappingPackage.TYPE_CONVERTER__NESTED_IN: 228 return getNestedIn() != null; 229 case MappingPackage.TYPE_CONVERTER__NESTED: 230 return nested != null && !nested.isEmpty(); 231 } 232 return eDynamicIsSet(eFeature); 233 } 234 235 } 237 | Popular Tags |