KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > mapping > ecore2xml > impl > XMLInfoImpl


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2005 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: XMLInfoImpl.java,v 1.3 2005/06/22 19:59:56 davidms Exp $
16  */

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 /**
30  * <!-- begin-user-doc -->
31  * An implementation of the model object '<em><b>XML Info</b></em>'.
32  * <!-- end-user-doc -->
33  * <p>
34  * The following features are implemented:
35  * <ul>
36  * <li>{@link org.eclipse.emf.mapping.ecore2xml.impl.XMLInfoImpl#getName <em>Name</em>}</li>
37  * <li>{@link org.eclipse.emf.mapping.ecore2xml.impl.XMLInfoImpl#getTargetNamespace <em>Target Namespace</em>}</li>
38  * <li>{@link org.eclipse.emf.mapping.ecore2xml.impl.XMLInfoImpl#getXMLRepresentation <em>XML Representation</em>}</li>
39  * </ul>
40  * </p>
41  *
42  * @generated
43  */

44 public class XMLInfoImpl extends EObjectImpl implements XMLInfo
45 {
46   
47   /**
48    * The default value of the '{@link #getName() <em>Name</em>}' attribute.
49    * <!-- begin-user-doc -->
50    * <!-- end-user-doc -->
51    * @see #getName()
52    * @generated
53    * @ordered
54    */

55   protected static final String JavaDoc NAME_EDEFAULT = null;
56   
57   /**
58    * The default value of the '{@link #getTargetNamespace() <em>Target Namespace</em>}' attribute.
59    * <!-- begin-user-doc -->
60    * <!-- end-user-doc -->
61    * @see #getTargetNamespace()
62    * @generated
63    * @ordered
64    */

65   protected static final String JavaDoc TARGET_NAMESPACE_EDEFAULT = null;
66   
67   /**
68    * The default value of the '{@link #getXMLRepresentation() <em>XML Representation</em>}' attribute.
69    * <!-- begin-user-doc -->
70    * <!-- end-user-doc -->
71    * @see #getXMLRepresentation()
72    * @generated
73    * @ordered
74    */

75   protected static final int XML_REPRESENTATION_EDEFAULT = -1;
76   
77   /**
78    * <!-- begin-user-doc -->
79    * <!-- end-user-doc -->
80    * @generated NOT
81    */

82   protected XMLInfoImpl()
83   {
84     super();
85
86     this.delegateXMLInfo = new org.eclipse.emf.ecore.xmi.impl.XMLInfoImpl();
87   }
88
89   /**
90    * <!-- begin-user-doc -->
91    * <!-- end-user-doc -->
92    * @generated
93    */

94   protected EClass eStaticClass()
95   {
96     return Ecore2XMLPackage.eINSTANCE.getXMLInfo();
97   }
98
99   /**
100    * <!-- begin-user-doc -->
101    * <!-- end-user-doc -->
102    * @generated NOT
103    */

104   public String JavaDoc getName()
105   {
106     return delegateXMLInfo.getName();
107   }
108   
109   /**
110    * <!-- begin-user-doc -->
111    * <!-- end-user-doc -->
112    * @generated NOT
113    */

114   public void setName(String JavaDoc newName)
115   {
116     String JavaDoc 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   /**
123    * <!-- begin-user-doc -->
124    * <!-- end-user-doc -->
125    * @generated NOT
126    */

127   public String JavaDoc getTargetNamespace()
128   {
129     return delegateXMLInfo.getTargetNamespace();
130   }
131   
132   /**
133    * <!-- begin-user-doc -->
134    * <!-- end-user-doc -->
135    * @generated NOT
136    */

137   public void setTargetNamespace(String JavaDoc newTargetNamespace)
138   {
139     String JavaDoc 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   /**
146    * <!-- begin-user-doc -->
147    * <!-- end-user-doc -->
148    * @generated NOT
149    */

150   public int getXMLRepresentation()
151   {
152     return delegateXMLInfo.getXMLRepresentation();
153   }
154   
155   /**
156    * <!-- begin-user-doc -->
157    * <!-- end-user-doc -->
158    * @generated NOT
159    */

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   /**
169    * <!-- begin-user-doc -->
170    * <!-- end-user-doc -->
171    * @generated
172    */

173   public Object JavaDoc 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 JavaDoc(getXMLRepresentation());
183     }
184     return eDynamicGet(eFeature, resolve);
185   }
186
187   /**
188    * <!-- begin-user-doc -->
189    * <!-- end-user-doc -->
190    * @generated
191    */

192   public void eSet(EStructuralFeature eFeature, Object JavaDoc newValue)
193   {
194     switch (eDerivedStructuralFeatureID(eFeature))
195     {
196       case Ecore2XMLPackage.XML_INFO__NAME:
197         setName((String JavaDoc)newValue);
198         return;
199       case Ecore2XMLPackage.XML_INFO__TARGET_NAMESPACE:
200         setTargetNamespace((String JavaDoc)newValue);
201         return;
202       case Ecore2XMLPackage.XML_INFO__XML_REPRESENTATION:
203         setXMLRepresentation(((Integer JavaDoc)newValue).intValue());
204         return;
205     }
206     eDynamicSet(eFeature, newValue);
207   }
208
209   /**
210    * <!-- begin-user-doc -->
211    * <!-- end-user-doc -->
212    * @generated
213    */

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   /**
232    * <!-- begin-user-doc -->
233    * <!-- end-user-doc -->
234    * @generated
235    */

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 } //XMLInfoImpl
260
Popular Tags