KickJava   Java API By Example, From Geeks To Geeks.

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


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: Ecore2XMLPackageImpl.java,v 1.2 2005/06/21 16:17:03 khussey Exp $
16  */

17 package org.eclipse.emf.mapping.ecore2xml.impl;
18
19 import java.util.Map JavaDoc;
20
21 import org.eclipse.emf.ecore.EAttribute;
22 import org.eclipse.emf.ecore.EClass;
23 import org.eclipse.emf.ecore.EPackage;
24 import org.eclipse.emf.ecore.EReference;
25 import org.eclipse.emf.ecore.EcorePackage;
26
27 import org.eclipse.emf.ecore.impl.EPackageImpl;
28 import org.eclipse.emf.ecore.impl.EcorePackageImpl;
29 import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLFactory;
30 import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage;
31 import org.eclipse.emf.mapping.ecore2xml.XMLInfo;
32 import org.eclipse.emf.mapping.ecore2xml.XMLMap;
33
34 /**
35  * <!-- begin-user-doc -->
36  * An implementation of the model <b>Package</b>.
37  * <!-- end-user-doc -->
38  * @generated
39  */

40 public class Ecore2XMLPackageImpl extends EPackageImpl implements Ecore2XMLPackage
41 {
42   
43   /**
44    * <!-- begin-user-doc -->
45    * <!-- end-user-doc -->
46    * @generated
47    */

48   private EClass xmlInfoEClass = null;
49   
50   /**
51    * <!-- begin-user-doc -->
52    * <!-- end-user-doc -->
53    * @generated
54    */

55   private EClass xmlMapEClass = null;
56   
57   /**
58    * <!-- begin-user-doc -->
59    * <!-- end-user-doc -->
60    * @generated
61    */

62   private EClass eNamedElementToXMLInfoMapEntryEClass = null;
63   
64   /**
65    * Creates an instance of the model <b>Package</b>, registered with
66    * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
67    * package URI value.
68    * <p>Note: the correct way to create the package is via the static
69    * factory method {@link #init init()}, which also performs
70    * initialization of the package, or returns the registered package,
71    * if one already exists.
72    * <!-- begin-user-doc -->
73    * <!-- end-user-doc -->
74    * @see org.eclipse.emf.ecore.EPackage.Registry
75    * @see org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage#eNS_URI
76    * @see #init()
77    * @generated
78    */

79   private Ecore2XMLPackageImpl()
80   {
81     super(eNS_URI, Ecore2XMLFactory.eINSTANCE);
82   }
83
84   /**
85    * <!-- begin-user-doc -->
86    * <!-- end-user-doc -->
87    * @generated
88    */

89   private static boolean isInited = false;
90   
91   /**
92    * Creates, registers, and initializes the <b>Package</b> for this
93    * model, and for any others upon which it depends. Simple
94    * dependencies are satisfied by calling this method on all
95    * dependent packages before doing anything else. This method drives
96    * initialization for interdependent packages directly, in parallel
97    * with this package, itself.
98    * <p>Of this package and its interdependencies, all packages which
99    * have not yet been registered by their URI values are first created
100    * and registered. The packages are then initialized in two steps:
101    * meta-model objects for all of the packages are created before any
102    * are initialized, since one package's meta-model objects may refer to
103    * those of another.
104    * <p>Invocation of this method will not affect any packages that have
105    * already been initialized.
106    * <!-- begin-user-doc -->
107    * <!-- end-user-doc -->
108    * @see #eNS_URI
109    * @see #createPackageContents()
110    * @see #initializePackageContents()
111    * @generated
112    */

113   public static Ecore2XMLPackage init()
114   {
115     if (isInited) return (Ecore2XMLPackage)EPackage.Registry.INSTANCE.getEPackage(Ecore2XMLPackage.eNS_URI);
116
117     // Obtain or create and register package
118
Ecore2XMLPackageImpl theEcore2XMLPackage = (Ecore2XMLPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof Ecore2XMLPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new Ecore2XMLPackageImpl());
119
120     isInited = true;
121
122     // Initialize simple dependencies
123
EcorePackageImpl.init();
124
125     // Create package meta-data objects
126
theEcore2XMLPackage.createPackageContents();
127
128     // Initialize created meta-data
129
theEcore2XMLPackage.initializePackageContents();
130
131     // Mark meta-data to indicate it can't be changed
132
theEcore2XMLPackage.freeze();
133
134     return theEcore2XMLPackage;
135   }
136
137   /**
138    * <!-- begin-user-doc -->
139    * <!-- end-user-doc -->
140    * @generated
141    */

142   public EClass getXMLInfo()
143   {
144     return xmlInfoEClass;
145   }
146
147   /**
148    * <!-- begin-user-doc -->
149    * <!-- end-user-doc -->
150    * @generated
151    */

152   public EAttribute getXMLInfo_Name()
153   {
154     return (EAttribute)xmlInfoEClass.getEStructuralFeatures().get(0);
155   }
156
157   /**
158    * <!-- begin-user-doc -->
159    * <!-- end-user-doc -->
160    * @generated
161    */

162   public EAttribute getXMLInfo_TargetNamespace()
163   {
164     return (EAttribute)xmlInfoEClass.getEStructuralFeatures().get(1);
165   }
166
167   /**
168    * <!-- begin-user-doc -->
169    * <!-- end-user-doc -->
170    * @generated
171    */

172   public EAttribute getXMLInfo_XMLRepresentation()
173   {
174     return (EAttribute)xmlInfoEClass.getEStructuralFeatures().get(2);
175   }
176
177   /**
178    * <!-- begin-user-doc -->
179    * <!-- end-user-doc -->
180    * @generated
181    */

182   public EClass getXMLMap()
183   {
184     return xmlMapEClass;
185   }
186
187   /**
188    * <!-- begin-user-doc -->
189    * <!-- end-user-doc -->
190    * @generated
191    */

192   public EAttribute getXMLMap_IDAttributeName()
193   {
194     return (EAttribute)xmlMapEClass.getEStructuralFeatures().get(0);
195   }
196
197   /**
198    * <!-- begin-user-doc -->
199    * <!-- end-user-doc -->
200    * @generated
201    */

202   public EReference getXMLMap_EcoreToXMLInfo()
203   {
204     return (EReference)xmlMapEClass.getEStructuralFeatures().get(1);
205   }
206
207   /**
208    * <!-- begin-user-doc -->
209    * <!-- end-user-doc -->
210    * @generated
211    */

212   public EReference getXMLMap_NoNamespacePackage()
213   {
214     return (EReference)xmlMapEClass.getEStructuralFeatures().get(2);
215   }
216
217   /**
218    * <!-- begin-user-doc -->
219    * <!-- end-user-doc -->
220    * @generated
221    */

222   public EClass getENamedElementToXMLInfoMapEntry()
223   {
224     return eNamedElementToXMLInfoMapEntryEClass;
225   }
226
227   /**
228    * <!-- begin-user-doc -->
229    * <!-- end-user-doc -->
230    * @generated
231    */

232   public EReference getENamedElementToXMLInfoMapEntry_Key()
233   {
234     return (EReference)eNamedElementToXMLInfoMapEntryEClass.getEStructuralFeatures().get(0);
235   }
236
237   /**
238    * <!-- begin-user-doc -->
239    * <!-- end-user-doc -->
240    * @generated
241    */

242   public EReference getENamedElementToXMLInfoMapEntry_Value()
243   {
244     return (EReference)eNamedElementToXMLInfoMapEntryEClass.getEStructuralFeatures().get(1);
245   }
246
247   /**
248    * <!-- begin-user-doc -->
249    * <!-- end-user-doc -->
250    * @generated
251    */

252   public Ecore2XMLFactory getEcore2XMLFactory()
253   {
254     return (Ecore2XMLFactory)getEFactoryInstance();
255   }
256
257   /**
258    * <!-- begin-user-doc -->
259    * <!-- end-user-doc -->
260    * @generated
261    */

262   private boolean isCreated = false;
263   
264   /**
265    * Creates the meta-model objects for the package. This method is
266    * guarded to have no affect on any invocation but its first.
267    * <!-- begin-user-doc -->
268    * <!-- end-user-doc -->
269    * @generated
270    */

271   public void createPackageContents()
272   {
273     if (isCreated) return;
274     isCreated = true;
275
276     // Create classes and their features
277
xmlInfoEClass = createEClass(XML_INFO);
278     createEAttribute(xmlInfoEClass, XML_INFO__NAME);
279     createEAttribute(xmlInfoEClass, XML_INFO__TARGET_NAMESPACE);
280     createEAttribute(xmlInfoEClass, XML_INFO__XML_REPRESENTATION);
281
282     xmlMapEClass = createEClass(XML_MAP);
283     createEAttribute(xmlMapEClass, XML_MAP__IDATTRIBUTE_NAME);
284     createEReference(xmlMapEClass, XML_MAP__ECORE_TO_XML_INFO);
285     createEReference(xmlMapEClass, XML_MAP__NO_NAMESPACE_PACKAGE);
286
287     eNamedElementToXMLInfoMapEntryEClass = createEClass(ENAMED_ELEMENT_TO_XML_INFO_MAP_ENTRY);
288     createEReference(eNamedElementToXMLInfoMapEntryEClass, ENAMED_ELEMENT_TO_XML_INFO_MAP_ENTRY__KEY);
289     createEReference(eNamedElementToXMLInfoMapEntryEClass, ENAMED_ELEMENT_TO_XML_INFO_MAP_ENTRY__VALUE);
290   }
291
292   /**
293    * <!-- begin-user-doc -->
294    * <!-- end-user-doc -->
295    * @generated
296    */

297   private boolean isInitialized = false;
298   
299   /**
300    * Complete the initialization of the package and its meta-model. This
301    * method is guarded to have no affect on any invocation but its first.
302    * <!-- begin-user-doc -->
303    * <!-- end-user-doc -->
304    * @generated
305    */

306   public void initializePackageContents()
307   {
308     if (isInitialized) return;
309     isInitialized = true;
310
311     // Initialize package
312
setName(eNAME);
313     setNsPrefix(eNS_PREFIX);
314     setNsURI(eNS_URI);
315
316     // Obtain other dependent packages
317
EcorePackageImpl theEcorePackage = (EcorePackageImpl)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
318
319     // Add supertypes to classes
320

321     // Initialize classes and features; add operations and parameters
322
initEClass(xmlInfoEClass, XMLInfo.class, "XMLInfo", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
323
initEAttribute(getXMLInfo_Name(), theEcorePackage.getEString(), "name", null, 0, 1, XMLInfo.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
324
initEAttribute(getXMLInfo_TargetNamespace(), theEcorePackage.getEString(), "targetNamespace", null, 0, 1, XMLInfo.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
325
initEAttribute(getXMLInfo_XMLRepresentation(), theEcorePackage.getEInt(), "xMLRepresentation", "-1", 0, 1, XMLInfo.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
326

327     initEClass(xmlMapEClass, XMLMap.class, "XMLMap", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
328
initEAttribute(getXMLMap_IDAttributeName(), theEcorePackage.getEString(), "iDAttributeName", null, 0, 1, XMLMap.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
329
initEReference(getXMLMap_EcoreToXMLInfo(), this.getENamedElementToXMLInfoMapEntry(), null, "ecoreToXMLInfo", null, 0, -1, XMLMap.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
330
initEReference(getXMLMap_NoNamespacePackage(), theEcorePackage.getEPackage(), null, "noNamespacePackage", null, 0, 1, XMLMap.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
331

332     initEClass(eNamedElementToXMLInfoMapEntryEClass, Map.Entry JavaDoc.class, "ENamedElementToXMLInfoMapEntry", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
333
initEReference(getENamedElementToXMLInfoMapEntry_Key(), theEcorePackage.getENamedElement(), null, "key", null, 1, 1, Map.Entry JavaDoc.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
334
initEReference(getENamedElementToXMLInfoMapEntry_Value(), this.getXMLInfo(), null, "value", null, 1, 1, Map.Entry JavaDoc.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
335

336     // Create resource
337
createResource(eNS_URI);
338   }
339
340 } //Ecore2XMLPackageImpl
341
Popular Tags