1 17 package org.eclipse.emf.mapping.ecore2xml.impl; 18 19 import org.eclipse.emf.common.notify.Notification; 20 import org.eclipse.emf.ecore.EClass; 21 import org.eclipse.emf.ecore.EStructuralFeature; 22 23 import org.eclipse.emf.ecore.impl.ENotificationImpl; 24 import org.eclipse.emf.ecore.impl.EObjectImpl; 25 import org.eclipse.emf.ecore.xmi.XMLResource; 26 import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage; 27 import org.eclipse.emf.mapping.ecore2xml.XMLInfo; 28 29 44 public class XMLInfoImpl extends EObjectImpl implements XMLInfo 45 { 46 47 55 protected static final String NAME_EDEFAULT = null; 56 57 65 protected static final String TARGET_NAMESPACE_EDEFAULT = null; 66 67 75 protected static final int XML_REPRESENTATION_EDEFAULT = -1; 76 77 82 protected XMLInfoImpl() 83 { 84 super(); 85 86 this.delegateXMLInfo = new org.eclipse.emf.ecore.xmi.impl.XMLInfoImpl(); 87 } 88 89 94 protected EClass eStaticClass() 95 { 96 return Ecore2XMLPackage.eINSTANCE.getXMLInfo(); 97 } 98 99 104 public String getName() 105 { 106 return delegateXMLInfo.getName(); 107 } 108 109 114 public void setName(String newName) 115 { 116 String oldName = delegateXMLInfo.getName(); 117 delegateXMLInfo.setName(newName); 118 if (eNotificationRequired()) 119 eNotify(new ENotificationImpl(this, Notification.SET, Ecore2XMLPackage.XML_INFO__NAME, oldName, newName)); 120 } 121 122 127 public String getTargetNamespace() 128 { 129 return delegateXMLInfo.getTargetNamespace(); 130 } 131 132 137 public void setTargetNamespace(String newTargetNamespace) 138 { 139 String oldTargetNamespace = delegateXMLInfo.getTargetNamespace(); 140 delegateXMLInfo.setTargetNamespace(newTargetNamespace); 141 if (eNotificationRequired()) 142 eNotify(new ENotificationImpl(this, Notification.SET, Ecore2XMLPackage.XML_INFO__TARGET_NAMESPACE, oldTargetNamespace, newTargetNamespace)); 143 } 144 145 150 public int getXMLRepresentation() 151 { 152 return delegateXMLInfo.getXMLRepresentation(); 153 } 154 155 160 public void setXMLRepresentation(int newXMLRepresentation) 161 { 162 int oldXMLRepresentation = delegateXMLInfo.getXMLRepresentation(); 163 delegateXMLInfo.setXMLRepresentation(newXMLRepresentation); 164 if (eNotificationRequired()) 165 eNotify(new ENotificationImpl(this, Notification.SET, Ecore2XMLPackage.XML_INFO__XML_REPRESENTATION, oldXMLRepresentation, newXMLRepresentation)); 166 } 167 168 173 public Object eGet(EStructuralFeature eFeature, boolean resolve) 174 { 175 switch (eDerivedStructuralFeatureID(eFeature)) 176 { 177 case Ecore2XMLPackage.XML_INFO__NAME: 178 return getName(); 179 case Ecore2XMLPackage.XML_INFO__TARGET_NAMESPACE: 180 return getTargetNamespace(); 181 case Ecore2XMLPackage.XML_INFO__XML_REPRESENTATION: 182 return new Integer (getXMLRepresentation()); 183 } 184 return eDynamicGet(eFeature, resolve); 185 } 186 187 192 public void eSet(EStructuralFeature eFeature, Object newValue) 193 { 194 switch (eDerivedStructuralFeatureID(eFeature)) 195 { 196 case Ecore2XMLPackage.XML_INFO__NAME: 197 setName((String )newValue); 198 return; 199 case Ecore2XMLPackage.XML_INFO__TARGET_NAMESPACE: 200 setTargetNamespace((String )newValue); 201 return; 202 case Ecore2XMLPackage.XML_INFO__XML_REPRESENTATION: 203 setXMLRepresentation(((Integer )newValue).intValue()); 204 return; 205 } 206 eDynamicSet(eFeature, newValue); 207 } 208 209 214 public void eUnset(EStructuralFeature eFeature) 215 { 216 switch (eDerivedStructuralFeatureID(eFeature)) 217 { 218 case Ecore2XMLPackage.XML_INFO__NAME: 219 setName(NAME_EDEFAULT); 220 return; 221 case Ecore2XMLPackage.XML_INFO__TARGET_NAMESPACE: 222 setTargetNamespace(TARGET_NAMESPACE_EDEFAULT); 223 return; 224 case Ecore2XMLPackage.XML_INFO__XML_REPRESENTATION: 225 setXMLRepresentation(XML_REPRESENTATION_EDEFAULT); 226 return; 227 } 228 eDynamicUnset(eFeature); 229 } 230 231 236 public boolean eIsSet(EStructuralFeature eFeature) 237 { 238 switch (eDerivedStructuralFeatureID(eFeature)) 239 { 240 case Ecore2XMLPackage.XML_INFO__NAME: 241 return NAME_EDEFAULT == null ? getName() != null : !NAME_EDEFAULT.equals(getName()); 242 case Ecore2XMLPackage.XML_INFO__TARGET_NAMESPACE: 243 return TARGET_NAMESPACE_EDEFAULT == null ? getTargetNamespace() != null : !TARGET_NAMESPACE_EDEFAULT.equals(getTargetNamespace()); 244 case Ecore2XMLPackage.XML_INFO__XML_REPRESENTATION: 245 return getXMLRepresentation() != XML_REPRESENTATION_EDEFAULT; 246 } 247 return eDynamicIsSet(eFeature); 248 } 249 250 protected XMLResource.XMLInfo delegateXMLInfo = null; 251 252 protected XMLInfoImpl(XMLResource.XMLInfo delegateXMLInfo) 253 { 254 super(); 255 256 this.delegateXMLInfo = delegateXMLInfo; 257 } 258 259 } | Popular Tags |