Debian Codegraph @

plugins/org.eclipse.emf.codegen.ecore/templates/model/PackageClass.javajet

raw
1 <%@ jet package="org.eclipse.emf.codegen.ecore.templates.model" imports="java.util.* org.eclipse.emf.ecore.* org.eclipse.emf.ecore.util.EcoreUtil org.eclipse.emf.codegen.ecore.genmodel.* org.eclipse.emf.codegen.ecore.genmodel.impl.Literals org.eclipse.emf.codegen.ecore.genmodel.util.GenModelUtil" class="PackageClass"%>
2 <%
3 /**
4 * Copyright (c) 2002-2010 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 v2.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v20.html
9 *
10 * Contributors:
11 * IBM - Initial API and implementation
12 */
13 %>
14 <%final GenPackage genPackage = (GenPackage)((Object[])argument)[0]; final GenModel genModel=genPackage.getGenModel();%>
15 <%final boolean isJDK50 = genModel.getComplianceLevel().getValue() >= GenJDKLevel.JDK50;%>
16 <%boolean isInterface = Boolean.TRUE.equals(((Object[])argument)[1]); boolean isImplementation = Boolean.TRUE.equals(((Object[])argument)[2]); boolean useInterfaceOverrideAnnotation = genModel.useInterfaceOverrideAnnotation() && !(isInterface && isImplementation);%>
17 <%boolean packageNeedsSuppressDeprecation = isJDK50 && GenModelUtil.hasAPIDeprecatedTag(genPackage.getOrderedGenClassifiers()) && !genPackage.hasAPIDeprecatedTag() && !genModel.isSuppressEMFMetaData();%>
18 <%String publicStaticFinalFlag = isImplementation ? "public static final " : "";%>
19 <%boolean needsAddEOperation = false;%>
20 <%boolean needsAddEParameter = false;%>
21 <%List<GenPackage> familyTreeDependencies = genPackage.getPackageFamilyTreeDependencies();%>
22 <%GenPackage familyHeadGenPackage = familyTreeDependencies.isEmpty() ? null : familyTreeDependencies.get(0);%>
23 <%boolean familyMember = familyHeadGenPackage != null && genPackage != familyHeadGenPackage;%>
24 <%@ include file="../Header.javajetinc"%>
25 <%if (isImplementation && !genModel.isSuppressInterfaces()) {%>
26 package <%=genPackage.getClassPackageName()%>;
27 <%} else {%>
28 package <%=genPackage.getReflectionPackageName()%>;
29 <%}%>
30
31 <%genModel.markImportLocation(stringBuffer, genPackage);%>
32 <%if (isImplementation) {%>
33 <%genModel.addPseudoImport("org.eclipse.emf.ecore.EPackage.Registry");%>
34 <%genModel.addPseudoImport("org.eclipse.emf.ecore.EPackage.Descriptor");%>
35 <%genModel.addPseudoImport("org.eclipse.emf.ecore.impl.EPackageImpl.EBasicWhiteList");%>
36 <%genModel.addPseudoImport("org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container");%>
37 <%genModel.addPseudoImport("org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container.Dynamic");%>
38 <%if (genPackage.isLiteralsInterface()) {%>
39 <%genModel.addPseudoImport(genPackage.getQualifiedPackageInterfaceName() + ".Literals");%>
40 <%}%>
41 <%for (GenClassifier genClassifier : genPackage.getOrderedGenClassifiers()) genModel.addPseudoImport(genPackage.getQualifiedPackageInterfaceName() + "." + genPackage.getClassifierID(genClassifier));%>
42 <%}%>
43 <%if (isInterface) {%>
44
45 /**
46 * <!-- begin-user-doc -->
47 * The <b>Package</b> for the model.
48 * It contains accessors for the meta objects to represent
49 * <ul>
50 * <li>each class,</li>
51 * <li>each feature of each class,</li>
52 <%if (genModel.isOperationReflection()) {%>
53 * <li>each operation of each class,</li>
54 <%}%>
55 * <li>each enum,</li>
56 * <li>and each data type</li>
57 * </ul>
58 * <!-- end-user-doc -->
59 <%if (genPackage.hasDocumentation()) {%>
60 * <!-- begin-model-doc -->
61 * <%=genPackage.getDocumentation(genModel.getIndentation(stringBuffer))%>
62 * <!-- end-model-doc -->
63 <%}%>
64 * @see <%=genPackage.getQualifiedFactoryInterfaceName()%>
65 <%if (!genModel.isSuppressEMFModelTags()) { boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genPackage.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false;%>
66 * @model <%=modelInfo%>
67 <%} else {%>
68 * <%=modelInfo%>
69 <%}} if (first) {%>
70 * @model
71 <%}}%>
72 * @generated
73 */
74 <%} else {%>
75
76 /**
77 * <!-- begin-user-doc -->
78 * An implementation of the model <b>Package</b>.
79 * <!-- end-user-doc -->
80 <%if (genPackage.hasAPITags()) {%>
81 * <%=genPackage.getAPITags(genModel.getIndentation(stringBuffer))%>
82 <%}%>
83 * @generated
84 */
85 <%}%>
86 <%if (isJDK50 && genPackage.hasAPIDeprecatedTag()) {%>
87 @Deprecated
88 <%}%>
89 <%if (isImplementation) {%>
90 <%if (packageNeedsSuppressDeprecation) {%>
91 @SuppressWarnings("deprecation")
92 <%}%>
93 public class <%=genPackage.getPackageClassName()%> extends <%=genModel.getImportedName("org.eclipse.emf.ecore.impl.EPackageImpl")%><%if (!isInterface){%> implements <%=genPackage.getImportedPackageInterfaceName()%><%}%>
94 <%} else {%>
95 public interface <%=genPackage.getPackageInterfaceName()%> extends <%=genModel.getImportedName("org.eclipse.emf.ecore.EPackage")%>
96 <%}%>
97 {
98 <%if (genModel.hasCopyrightField()) {%>
99 /**
100 * <!-- begin-user-doc -->
101 * <!-- end-user-doc -->
102 * @generated
103 */
104 <%=publicStaticFinalFlag%><%=genModel.getImportedName("java.lang.String")%> copyright = <%=genModel.getCopyrightFieldLiteral()%>;<%=genModel.getNonNLS()%>
105
106 <%}%>
107 <%if (isInterface) {%>
108 /**
109 * The package name.
110 * <!-- begin-user-doc -->
111 * <!-- end-user-doc -->
112 * @generated
113 */
114 <%=publicStaticFinalFlag%><%=genModel.getImportedName("java.lang.String")%> eNAME = "<%=genPackage.getPackageName()%>";<%=genModel.getNonNLS()%>
115
116 /**
117 * The package namespace URI.
118 * <!-- begin-user-doc -->
119 * <!-- end-user-doc -->
120 * @generated
121 */
122 <%=publicStaticFinalFlag%><%=genModel.getImportedName("java.lang.String")%> eNS_URI = "<%=genPackage.getNSURI()%>";<%=genModel.getNonNLS()%>
123
124 /**
125 * The package namespace name.
126 * <!-- begin-user-doc -->
127 * <!-- end-user-doc -->
128 * @generated
129 */
130 <%=publicStaticFinalFlag%><%=genModel.getImportedName("java.lang.String")%> eNS_PREFIX = "<%=genPackage.getNSName()%>";<%=genModel.getNonNLS()%>
131 <%if (genPackage.isContentType()) {%>
132
133 /**
134 * The package content type ID.
135 * <!-- begin-user-doc -->
136 * <!-- end-user-doc -->
137 * @generated
138 */
139 <%=publicStaticFinalFlag%><%=genModel.getImportedName("java.lang.String")%> eCONTENT_TYPE = "<%=genPackage.getContentTypeIdentifier()%>";<%=genModel.getNonNLS()%>
140 <%}%>
141
142 /**
143 * The singleton instance of the package.
144 * <!-- begin-user-doc -->
145 * <!-- end-user-doc -->
146 * @generated
147 */
148 <%=publicStaticFinalFlag%><%=genPackage.getPackageInterfaceName()%> eINSTANCE = <%=genPackage.getQualifiedPackageClassName()%>.init();
149
150 <%for (GenClassifier genClassifier : genPackage.getOrderedGenClassifiers()) {%>
151 /**
152 <%if (genClassifier instanceof GenClass) { GenClass genClass = (GenClass)genClassifier;%>
153 <%if (!genClass.isInterface()) {%>
154 * The meta object id for the '{@link <%=genClass.getQualifiedClassName()%> <em><%=genClass.getFormattedName()%></em>}' class.
155 * <!-- begin-user-doc -->
156 * <!-- end-user-doc -->
157 * @see <%=genClass.getQualifiedClassName()%>
158 <%} else {%>
159 * The meta object id for the '{@link <%=genClass.getRawQualifiedInterfaceName()%> <em><%=genClass.getFormattedName()%></em>}' class.
160 * <!-- begin-user-doc -->
161 * <!-- end-user-doc -->
162 * @see <%=genClass.getRawQualifiedInterfaceName()%>
163 <%}%>
164 <%} else if (genClassifier instanceof GenEnum) { GenEnum genEnum = (GenEnum)genClassifier;%>
165 * The meta object id for the '{@link <%=genEnum.getQualifiedName()%> <em><%=genEnum.getFormattedName()%></em>}' enum.
166 * <!-- begin-user-doc -->
167 * <!-- end-user-doc -->
168 * @see <%=genEnum.getQualifiedName()%>
169 <%} else if (genClassifier instanceof GenDataType) { GenDataType genDataType = (GenDataType)genClassifier;%>
170 * The meta object id for the '<em><%=genDataType.getFormattedName()%></em>' data type.
171 * <!-- begin-user-doc -->
172 * <!-- end-user-doc -->
173 <%if (!genDataType.isPrimitiveType() && !genDataType.isArrayType()) {%>
174 * @see <%=genDataType.getRawInstanceClassName()%>
175 <%}%>
176 <%}%>
177 * @see <%=genPackage.getQualifiedPackageClassName()%>#get<%=genClassifier.getClassifierAccessorName()%>()
178 <%if (genClassifier.hasAPITags()) {%>
179 * <%=genClassifier.getAPITags(genModel.getIndentation(stringBuffer))%>
180 <%}%>
181 * @generated
182 */
183 <%if (isJDK50 && genClassifier.hasAPIDeprecatedTag()) {%>
184 @Deprecated
185 <%}%>
186 <%=publicStaticFinalFlag%>int <%=genPackage.getClassifierID(genClassifier)%> = <%=genPackage.getClassifierValue(genClassifier)%>;
187
188 <%if (genClassifier instanceof GenClass) { GenClass genClass = (GenClass)genClassifier;%>
189 <%for (GenFeature genFeature : genClass.getAllGenFeatures()) {%>
190 /**
191 * The feature id for the '<em><b><%=genFeature.getFormattedName()%></b></em>' <%=genFeature.getFeatureKind()%>.
192 * <!-- begin-user-doc -->
193 * <!-- end-user-doc -->
194 <%if (genFeature.hasImplicitAPITags()) {%>
195 * <%=genFeature.getImplicitAPITags(genModel.getIndentation(stringBuffer))%>
196 <%}%>
197 * @generated
198 * @ordered
199 */
200 <%if (isJDK50 && genFeature.hasImplicitAPIDeprecatedTag()) {%>
201 @Deprecated
202 <%}%>
203 <%=publicStaticFinalFlag%>int <%=genClass.getFeatureID(genFeature)%> = <%=genClass.getFeatureValue(genFeature)%>;
204
205 <%}%>
206 /**
207 * The number of structural features of the '<em><%=genClass.getFormattedName()%></em>' class.
208 * <!-- begin-user-doc -->
209 * <!-- end-user-doc -->
210 <%if (genClass.hasAPITags()) {%>
211 * <%=genClass.getAPITags(genModel.getIndentation(stringBuffer))%>
212 <%}%>
213 * @generated
214 * @ordered
215 */
216 <%if (isJDK50 && genClass.hasAPIDeprecatedTag()) {%>
217 @Deprecated
218 <%}%>
219 <%=publicStaticFinalFlag%>int <%=genClass.getFeatureCountID()%> = <%=genClass.getFeatureCountValue()%>;
220
221 <%if (genModel.isOperationReflection()) {%>
222 <%for (GenOperation genOperation : genClass.getAllGenOperations(false)) {%>
223 <%if (genClass.getOverrideGenOperation(genOperation) == null) {%>
224 /**
225 * The operation id for the '<em><%=genOperation.getFormattedName()%></em>' operation.
226 * <!-- begin-user-doc -->
227 * <!-- end-user-doc -->
228 <%if (genOperation.hasImplicitAPITags()) {%>
229 * <%=genOperation.getImplicitAPITags(genModel.getIndentation(stringBuffer))%>
230 <%}%>
231 * @generated
232 * @ordered
233 */
234 <%if (isJDK50 && genOperation.hasImplicitAPIDeprecatedTag()) {%>
235 @Deprecated
236 <%}%>
237 <%=publicStaticFinalFlag%>int <%=genClass.getOperationID(genOperation, false)%> = <%=genClass.getOperationValue(genOperation)%>;
238
239 <%}%>
240 <%}%>
241 /**
242 * The number of operations of the '<em><%=genClass.getFormattedName()%></em>' class.
243 * <!-- begin-user-doc -->
244 * <!-- end-user-doc -->
245 <%if (genClass.hasAPITags()) {%>
246 * <%=genClass.getAPITags(genModel.getIndentation(stringBuffer))%>
247 <%}%>
248 * @generated
249 * @ordered
250 */
251 <%if (isJDK50 && genClass.hasAPIDeprecatedTag()) {%>
252 @Deprecated
253 <%}%>
254 <%=publicStaticFinalFlag%>int <%=genClass.getOperationCountID()%> = <%=genClass.getOperationCountValue()%>;
255
256 <%}%>
257 <%}%>
258 <%}%>
259 <%}%>
260 <%if (isImplementation) {%>
261 <%if (genPackage.isLoadingInitialization()) {%>
262 /**
263 * <!-- begin-user-doc -->
264 * <!-- end-user-doc -->
265 * @generated
266 */
267 protected String packageFilename = "<%=genPackage.getSerializedPackageFilename()%>";<%=genModel.getNonNLS()%>
268
269 <%}%>
270 <%for (GenClassifier genClassifier : genPackage.getGenClassifiers()) {%>
271 /**
272 * <!-- begin-user-doc -->
273 * <!-- end-user-doc -->
274 <%if (genClassifier.hasAPITags(true)) {%>
275 * <%=genClassifier.getAPITags(genModel.getIndentation(stringBuffer), true)%>
276 <%}%>
277 * @generated
278 */
279 <%if (isJDK50 && genClassifier.hasAPIDeprecatedTag()) {%>
280 @Deprecated
281 <%}%>
282 private <%=genClassifier.getImportedMetaType()%> <%=genClassifier.getClassifierInstanceName()%> = null;
283
284 <%}%>
285 /**
286 * Creates an instance of the model <b>Package</b>, registered with
287 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
288 * package URI value.
289 * <p>Note: the correct way to create the package is via the static
290 * factory method {@link #init init()}, which also performs
291 * initialization of the package, or returns the registered package,
292 * if one already exists.
293 * <!-- begin-user-doc -->
294 * <!-- end-user-doc -->
295 * @see org.eclipse.emf.ecore.EPackage.Registry
296 * @see <%=genPackage.getQualifiedPackageInterfaceName()%>#eNS_URI
297 * @see #init()
298 * @generated
299 */
300 <%if (familyMember) {%>public<%} else {%>private<%}%> <%=genPackage.getPackageClassName()%>()
301 {
302 super(eNS_URI, <%=genPackage.getQualifiedEFactoryInstanceAccessor()%>);
303 }
304 <%if (!familyMember) {%>
305 /**
306 * <!-- begin-user-doc -->
307 * <!-- end-user-doc -->
308 * @generated
309 */
310 private static boolean isInited = false;
311
312 <%}%>
313 /**
314 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
315 *
316 * <p>This method is used to initialize {@link <%=genPackage.getImportedPackageInterfaceName()%>#eINSTANCE} when that field is accessed.
317 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
318 * <!-- begin-user-doc -->
319 * <!-- end-user-doc -->
320 * @see #eNS_URI
321 <%if (!genPackage.isLoadedInitialization()) {%>
322 * @see #createPackageContents()
323 * @see #initializePackageContents()
324 <%}%>
325 * @generated
326 */
327 public static <%=genPackage.getImportedPackageInterfaceName()%> init()
328 {
329 <%if (familyMember) {%>
330 // Initialize the family head to initialize the entire family
331 <%=familyHeadGenPackage.getImportedPackageInterfaceName()%>.eINSTANCE.eClass();
332 return (<%=genPackage.getImportedPackageInterfaceName()%>)<%=genModel.getImportedName("org.eclipse.emf.ecore.EPackage")%>.Registry.INSTANCE.getEPackage(<%=genPackage.getImportedPackageInterfaceName()%>.eNS_URI);
333 <%} else {%>
334 if (isInited) return (<%=genPackage.getImportedPackageInterfaceName()%>)<%=genModel.getImportedName("org.eclipse.emf.ecore.EPackage")%>.Registry.INSTANCE.getEPackage(<%=genPackage.getImportedPackageInterfaceName()%>.eNS_URI);
335
336 <%if (genModel.getRuntimePlatform() == GenRuntimePlatform.GWT) {%>
337 initializeRegistryHelpers();
338
339 <%}%>
340 // Obtain or create and register package
341 Object registered<%=genPackage.getBasicPackageName()%> = <%=genModel.getImportedName("org.eclipse.emf.ecore.EPackage")%>.Registry.INSTANCE.get(eNS_URI);
342 <%=genPackage.getPackageClassName()%> the<%=genPackage.getBasicPackageName()%> = registered<%=genPackage.getBasicPackageName()%> instanceof <%=genPackage.getPackageClassName()%> ? (<%=genPackage.getPackageClassName()%>)registered<%=genPackage.getBasicPackageName()%> : new <%=genPackage.getPackageClassName()%>();
343
344 isInited = true;
345
346 <%if (!genPackage.getPackageSimpleDependencies().isEmpty()) {%>
347 // Initialize simple dependencies
348 <%for (GenPackage dep : genPackage.getPackageSimpleDependencies()) {%>
349 <%=dep.getImportedPackageInterfaceName()%>.eINSTANCE.eClass();
350 <%}%>
351
352 <%}%>
353 <%if (!genPackage.getPackageInterDependencies().isEmpty()) {%>
354 // Obtain or create and register interdependencies
355 <%for (ListIterator<GenPackage> i = genPackage.getPackageInterDependencies().listIterator(); i.hasNext(); ) { GenPackage interdep = i.next(); %>
356 <%if (i.previousIndex() == 0) {%>Object <%}%>registeredPackage = <%=genModel.getImportedName("org.eclipse.emf.ecore.EPackage")%>.Registry.INSTANCE.<%if (familyTreeDependencies.contains(interdep)) {%>get<%} else {%>getEPackage<%}%>(<%=interdep.getImportedPackageInterfaceName()%>.eNS_URI);
357 <%=interdep.getImportedPackageClassName()%> <%=genPackage.getPackageInstanceVariable(interdep)%> = (<%=interdep.getImportedPackageClassName()%>)(registeredPackage instanceof <%=interdep.getImportedPackageClassName()%> ? registeredPackage : <%if (familyTreeDependencies.contains(interdep)) {%>new <%=interdep.getImportedPackageClassName()%>()<%} else {%><%=interdep.getImportedPackageInterfaceName()%>.eINSTANCE<%}%>);
358 <%}%>
359
360 <%}%>
361 <%if (genPackage.isLoadedInitialization() || !genPackage.getPackageLoadInterDependencies().isEmpty()) {%>
362 // Load packages
363 <%if (genPackage.isLoadingInitialization()) {%>
364 the<%=genPackage.getBasicPackageName()%>.loadPackage();
365 <%}%>
366 <%for (GenPackage interdep : genPackage.getPackageLoadInterDependencies()) {%>
367 <%if (interdep.isLoadingInitialization()) {%>
368 <%=genPackage.getPackageInstanceVariable(interdep)%>.loadPackage();
369 <%}%>
370 <%}%>
371
372 <%}%>
373 <%if (!genPackage.isLoadedInitialization() || !genPackage.getPackageBuildInterDependencies().isEmpty()) {%>
374 // Create package meta-data objects
375 <%if (!genPackage.isLoadedInitialization()) {%>
376 the<%=genPackage.getBasicPackageName()%>.createPackageContents();
377 <%}%>
378 <%for (GenPackage interdep : genPackage.getPackageBuildInterDependencies()) {%>
379 <%=genPackage.getPackageInstanceVariable(interdep)%>.createPackageContents();
380 <%}%>
381
382 // Initialize created meta-data
383 <%if (!genPackage.isLoadedInitialization()) {%>
384 the<%=genPackage.getBasicPackageName()%>.initializePackageContents();
385 <%}%>
386 <%for (GenPackage interdep : genPackage.getPackageBuildInterDependencies()) {%>
387 <%=genPackage.getPackageInstanceVariable(interdep)%>.initializePackageContents();
388 <%}%>
389
390 <%}%>
391 <%if (genPackage.isLoadedInitialization() || !genPackage.getPackageLoadInterDependencies().isEmpty()) {%>
392 // Fix loaded packages
393 <%if (genPackage.isLoadedInitialization()) {%>
394 the<%=genPackage.getBasicPackageName()%>.fixPackageContents();
395 <%}%>
396 <%for (GenPackage interdep : genPackage.getPackageLoadInterDependencies()) {%>
397 <%=genPackage.getPackageInstanceVariable(interdep)%>.fixPackageContents();
398 <%}%>
399
400 <%}%>
401 <%if (genPackage.hasConstraints()) {%>
402 // Register package validator
403 <%=genModel.getImportedName("org.eclipse.emf.ecore.EValidator")%>.Registry.INSTANCE.put
404 (the<%=genPackage.getBasicPackageName()%>,
405 new <%=genModel.getImportedName("org.eclipse.emf.ecore.EValidator")%>.Descriptor()
406 {
407 <%if (genModel.useInterfaceOverrideAnnotation()) {%>
408 @Override
409 <%}%>
410 public <%=genModel.getImportedName("org.eclipse.emf.ecore.EValidator")%> getEValidator()
411 {
412 return <%=genPackage.getImportedValidatorClassName()%>.INSTANCE;
413 }
414 });
415
416 <%}%>
417 <%if (!familyTreeDependencies.isEmpty()) {%>
418 // Freeze and register the family tree packages.
419 <%for (GenPackage familyMemberPackage : familyTreeDependencies.subList(1, familyTreeDependencies.size())) {%>
420 <%=genPackage.getPackageInstanceVariable(familyMemberPackage)%>.freeze();
421 <%=genModel.getImportedName("org.eclipse.emf.ecore.EPackage")%>.Registry.INSTANCE.put(<%=familyMemberPackage.getImportedPackageInterfaceName()%>.eNS_URI, <%=genPackage.getPackageInstanceVariable(familyMemberPackage)%>);
422 <%}%>
423
424 <%}%>
425 <%if (!genPackage.isEcorePackage()) {%>
426 // Mark meta-data to indicate it can't be changed
427 the<%=genPackage.getBasicPackageName()%>.freeze();
428
429 <%}%>
430 // Update the registry and return the package
431 <%=genModel.getImportedName("org.eclipse.emf.ecore.EPackage")%>.Registry.INSTANCE.put(<%=genPackage.getImportedPackageInterfaceName()%>.eNS_URI, the<%=genPackage.getBasicPackageName()%>);
432 return the<%=genPackage.getBasicPackageName()%>;
433 <%}%>
434 }
435 <%if (genModel.getRuntimePlatform() == GenRuntimePlatform.GWT) {%>
436
437 /**
438 * <!-- begin-user-doc -->
439 * <!-- end-user-doc -->
440 * @generated
441 */
442 public static void initializeRegistryHelpers()
443 {
444 <%Set<String> helpers = new HashSet<String>(); for (GenClassifier genClassifier : genPackage.getGenClassifiers()) {%>
445 <%if (genClassifier instanceof GenClass) { GenClass genClass = (GenClass)genClassifier;%>
446 <%if (!genClass.isDynamic()) { String theClass = genClass.isMapEntry() ? genClass.getImportedClassName() : genClass.getRawImportedInterfaceName(); if (helpers.add(theClass)) {%>
447 <%=genModel.getImportedName("org.eclipse.emf.common.util.Reflect")%>.register
448 (<%=theClass%>.class,
449 new <%=genModel.getImportedName("org.eclipse.emf.common.util.Reflect")%>.Helper()
450 {
451 public boolean isInstance(Object instance)
452 {
453 return instance instanceof <%=genClass.isMapEntry() ? genClass.getImportedClassName() : genClass.getRawImportedInterfaceName() + genClass.getInterfaceWildTypeArguments()%>;
454 }
455
456 public Object newArrayInstance(int size)
457 {
458 return new <%=theClass%>[size];
459 }
460 });
461 <%}}%>
462 <%} else if (genClassifier instanceof GenDataType) { GenDataType genDataType = (GenDataType)genClassifier;%>
463 <%if (!genDataType.isPrimitiveType() && !genDataType.isObjectType()) { String theClass = genDataType.getRawImportedInstanceClassName(); if (helpers.add(theClass)) { %>
464 <%=genModel.getImportedName("org.eclipse.emf.common.util.Reflect")%>.register
465 (<%=theClass%>.class,
466 new <%=genModel.getImportedName("org.eclipse.emf.common.util.Reflect")%>.Helper()
467 {
468 public boolean isInstance(Object instance)
469 {
470 return instance instanceof <%=theClass%>;
471 }
472
473 public Object newArrayInstance(int size)
474 {
475 <%if (genDataType.isArrayType()) { String componentType = theClass; String indices = ""; while(componentType.endsWith("[]")) { componentType = componentType.substring(0, componentType.length() - 2); indices += "[]";}%>
476 return new <%=componentType%>[size]<%=indices%>;
477 <%} else {%>
478 return new <%=theClass%>[size];
479 <%}%>
480 }
481 });
482 <%}}%>
483 <%}%>
484 <%}%>
485 }
486
487
488 /**
489 * <!-- begin-user-doc -->
490 * <!-- end-user-doc -->
491 * @generated
492 */
493 public static class WhiteList implements <%=genModel.getImportedName("com.google.gwt.user.client.rpc.IsSerializable")%>, EBasicWhiteList
494 {
495 <%for (GenClassifier genClassifier : genPackage.getGenClassifiers()) {%>
496 <%if (genClassifier instanceof GenClass) { GenClass genClass = (GenClass)genClassifier;%>
497 <%if (!genClass.isDynamic()) {%>
498 /**
499 * <!-- begin-user-doc -->
500 * <!-- end-user-doc -->
501 * @generated
502 */
503 protected <%=genClass.isMapEntry() ? genClass.getImportedClassName() : genClass.getImportedWildcardInstanceClassName()%> <%=genClass.getSafeUncapName()%>;
504
505 <%}%>
506 <%} else if (genClassifier instanceof GenDataType) { GenDataType genDataType = (GenDataType)genClassifier;%>
507 <%if (!genDataType.isObjectType() && genDataType.isSerializable()) {%>
508 /**
509 * <!-- begin-user-doc -->
510 * <!-- end-user-doc -->
511 * @generated
512 */
513 protected <%=genDataType.getImportedWildcardInstanceClassName()%> <%=genDataType.getSafeUncapName()%>;
514
515 <%}%>
516 <%}%>
517 <%}%>
518 }
519 <%}%>
520
521 <%}%>
522 <%if (isInterface) { // TODO REMOVE THIS BOGUS EMPTY LINE%>
523
524 <%}%>
525 <%for (GenClassifier genClassifier : genPackage.getGenClassifiers()) {%>
526 <%if (isInterface) {%>
527 /**
528 <%if (genClassifier instanceof GenClass) { GenClass genClass = (GenClass)genClassifier;%>
529 * Returns the meta object for class '{@link <%=genClass.getRawQualifiedInterfaceName()%> <em><%=genClass.getFormattedName()%></em>}'.
530 * <!-- begin-user-doc -->
531 * <!-- end-user-doc -->
532 * @return the meta object for class '<em><%=genClass.getFormattedName()%></em>'.
533 * @see <%=genClass.getRawQualifiedInterfaceName()%>
534 <%if (!genModel.isSuppressEMFModelTags() && (genClass.isExternalInterface() || genClass.isDynamic())) { boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genClass.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false;%>
535 * @model <%=modelInfo%>
536 <%} else {%>
537 * <%=modelInfo%>
538 <%}} if (first) {%>
539 * @model
540 <%}}%>
541 <%} else if (genClassifier instanceof GenEnum) { GenEnum genEnum = (GenEnum)genClassifier;%>
542 * Returns the meta object for enum '{@link <%=genEnum.getQualifiedName()%> <em><%=genEnum.getFormattedName()%></em>}'.
543 * <!-- begin-user-doc -->
544 * <!-- end-user-doc -->
545 * @return the meta object for enum '<em><%=genEnum.getFormattedName()%></em>'.
546 * @see <%=genEnum.getQualifiedName()%>
547 <%} else if (genClassifier instanceof GenDataType) { GenDataType genDataType = (GenDataType)genClassifier;%>
548 <%if (genDataType.isPrimitiveType() || genDataType.isArrayType()) {%>
549 * Returns the meta object for data type '<em><%=genDataType.getFormattedName()%></em>'.
550 <%} else {%>
551 * Returns the meta object for data type '{@link <%=genDataType.getRawInstanceClassName()%> <em><%=genDataType.getFormattedName()%></em>}'.
552 <%}%>
553 * <!-- begin-user-doc -->
554 * <!-- end-user-doc -->
555 <%if (genDataType.hasDocumentation()) {%>
556 * <!-- begin-model-doc -->
557 * <%=genDataType.getDocumentation(genModel.getIndentation(stringBuffer))%>
558 * <!-- end-model-doc -->
559 <%}%>
560 * @return the meta object for data type '<em><%=genDataType.getFormattedName()%></em>'.
561 <%if (!genDataType.isPrimitiveType() && !genDataType.isArrayType()) {%>
562 * @see <%=genDataType.getRawInstanceClassName()%>
563 <%}%>
564 <%if (!genModel.isSuppressEMFModelTags()) {boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genDataType.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false;%>
565 * @model <%=modelInfo%>
566 <%} else {%>
567 * <%=modelInfo%>
568 <%}} if (first) {%>
569 * @model
570 <%}}%>
571 <%}%>
572 <%if ((genClassifier instanceof GenClass || genClassifier instanceof GenEnum) && genClassifier.hasAPITags()) {%>
573 * <%=genClassifier.getAPITags(genModel.getIndentation(stringBuffer))%>
574 <%}%>
575 * @generated
576 */
577 <%} else {%>
578 /**
579 * <!-- begin-user-doc -->
580 * <!-- end-user-doc -->
581 <%if (genClassifier.hasAPITags()) {%>
582 * <%=genClassifier.getAPITags(genModel.getIndentation(stringBuffer))%>
583 <%}%>
584 * @generated
585 */
586 <%}%>
587 <%if (isJDK50 && genClassifier.hasAPIDeprecatedTag()) {%>
588 @Deprecated
589 <%}%>
590 <%if (isImplementation) {%>
591 <%if (useInterfaceOverrideAnnotation) {%>
592 @Override
593 <%}%>
594 public <%=genClassifier.getImportedMetaType()%> get<%=genClassifier.getClassifierAccessorName()%>()
595 {
596 <%if (genPackage.isLoadedInitialization()) {%>
597 if (<%=genClassifier.getClassifierInstanceName()%> == null)
598 {
599 <%=genClassifier.getClassifierInstanceName()%> = (<%=genClassifier.getImportedMetaType()%>)<%=genModel.getImportedName("org.eclipse.emf.ecore.EPackage")%>.Registry.INSTANCE.getEPackage(<%=genPackage.getImportedPackageInterfaceName()%>.eNS_URI).getEClassifiers().get(<%=genPackage.getLocalClassifierIndex(genClassifier)%>);
600 }
601 <%}%>
602 return <%=genClassifier.getClassifierInstanceName()%>;
603 }
604
605 <%} else {%>
606 <%=genClassifier.getImportedMetaType()%> get<%=genClassifier.getClassifierAccessorName()%>();
607
608 <%}%>
609 <%if (genClassifier instanceof GenClass) { GenClass genClass = (GenClass)genClassifier;%>
610 <%for (GenFeature genFeature : genClass.getGenFeatures()) {%>
611 <%if (isInterface) {%>
612 /**
613 * Returns the meta object for the <%=genFeature.getFeatureKind()%> '{@link <%=genClass.getRawQualifiedInterfaceName()%><%if (!genClass.isMapEntry() && !genFeature.isSuppressedGetVisibility()) {%>#<%=genFeature.getGetAccessor()%><%}%> <em><%=genFeature.getFormattedName()%></em>}'.
614 * <!-- begin-user-doc -->
615 * <!-- end-user-doc -->
616 * @return the meta object for the <%=genFeature.getFeatureKind()%> '<em><%=genFeature.getFormattedName()%></em>'.
617 * @see <%=genClass.getRawQualifiedInterfaceName()%><%if (!genClass.isMapEntry() && !genFeature.isSuppressedGetVisibility()) {%>#<%=genFeature.getGetAccessor()%>()<%}%>
618 * @see #get<%=genClass.getClassifierAccessorName()%>()
619 <%if (genFeature.hasImplicitAPITags()) {%>
620 * <%=genFeature.getImplicitAPITags(genModel.getIndentation(stringBuffer))%>
621 <%}%>
622 * @generated
623 */
624 <%} else {%>
625 /**
626 * <!-- begin-user-doc -->
627 * <!-- end-user-doc -->
628 <%if (genFeature.hasImplicitAPITags()) {%>
629 * <%=genFeature.getImplicitAPITags(genModel.getIndentation(stringBuffer))%>
630 <%}%>
631 * @generated
632 */
633 <%}%>
634 <%if (isJDK50 && genFeature.hasImplicitAPIDeprecatedTag()) {%>
635 @Deprecated
636 <%}%>
637 <%if (isImplementation) {%>
638 <%if (useInterfaceOverrideAnnotation) {%>
639 @Override
640 <%}%>
641 public <%=genFeature.getImportedMetaType()%> get<%=genFeature.getFeatureAccessorName()%>()
642 {
643 <%if (!genPackage.isLoadedInitialization()) {%>
644 return (<%=genFeature.getImportedMetaType()%>)<%=genClass.getClassifierInstanceName()%>.getEStructuralFeatures().get(<%=genClass.getLocalFeatureIndex(genFeature)%>);
645 <%} else {%>
646 return (<%=genFeature.getImportedMetaType()%>)get<%=genClassifier.getClassifierAccessorName()%>().getEStructuralFeatures().get(<%=genClass.getLocalFeatureIndex(genFeature)%>);
647 <%}%>
648 }
649 <%} else {%>
650 <%=genFeature.getImportedMetaType()%> get<%=genFeature.getFeatureAccessorName()%>();
651 <%}%>
652
653 <%}%>
654 <%if (genModel.isOperationReflection()) {%>
655 <%for (GenOperation genOperation : genClass.getGenOperations()) {%>
656 <%if (isInterface) {%>
657 /**
658 * Returns the meta object for the '{@link <%=genClass.getRawQualifiedInterfaceName()%>#<%=genOperation.getName()%>(<%=genOperation.getParameterTypes(", ")%>) <em><%=genOperation.getFormattedName()%></em>}' operation.
659 * <!-- begin-user-doc -->
660 * <!-- end-user-doc -->
661 * @return the meta object for the '<em><%=genOperation.getFormattedName()%></em>' operation.
662 * @see <%=genClass.getRawQualifiedInterfaceName()%>#<%=genOperation.getName()%>(<%=genOperation.getParameterTypes(", ")%>)
663 <%if (genOperation.hasImplicitAPITags()) {%>
664 * <%=genOperation.getImplicitAPITags(genModel.getIndentation(stringBuffer))%>
665 <%}%>
666 * @generated
667 */
668 <%} else {%>
669 /**
670 * <!-- begin-user-doc -->
671 * <!-- end-user-doc -->
672 <%if (genOperation.hasImplicitAPITags()) {%>
673 * <%=genOperation.getImplicitAPITags(genModel.getIndentation(stringBuffer))%>
674 <%}%>
675 * @generated
676 */
677 <%}%>
678 <%if (isJDK50 && genOperation.hasImplicitAPIDeprecatedTag()) {%>
679 @Deprecated
680 <%}%>
681 <%if (isImplementation) {%>
682 <%if (useInterfaceOverrideAnnotation) {%>
683 @Override
684 <%}%>
685 public <%=genOperation.getImportedMetaType()%> get<%=genOperation.getOperationAccessorName()%>()
686 {
687 <%if (!genPackage.isLoadedInitialization()) {%>
688 return <%=genClass.getClassifierInstanceName()%>.getEOperations().get(<%=genClass.getLocalOperationIndex(genOperation)%>);
689 <%} else {%>
690 return get<%=genClassifier.getClassifierAccessorName()%>().getEOperations().get(<%=genClass.getLocalOperationIndex(genOperation)%>);
691 <%}%>
692 }
693 <%} else {%>
694 <%=genOperation.getImportedMetaType()%> get<%=genOperation.getOperationAccessorName()%>();
695 <%}%>
696
697 <%}%>
698 <%}%>
699 <%}%>
700 <%}%>
701 <%if (isInterface) {%>
702 /**
703 * Returns the factory that creates the instances of the model.
704 * <!-- begin-user-doc -->
705 * <!-- end-user-doc -->
706 * @return the factory that creates the instances of the model.
707 * @generated
708 */
709 <%} else {%>
710 /**
711 * <!-- begin-user-doc -->
712 * <!-- end-user-doc -->
713 * @generated
714 */
715 <%}%>
716 <%if (isImplementation) {%>
717 <%if (useInterfaceOverrideAnnotation) {%>
718 @Override
719 <%}%>
720 public <%=genPackage.getImportedFactoryInterfaceName()%> get<%=genPackage.getFactoryName()%>()
721 {
722 return (<%=genPackage.getImportedFactoryInterfaceName()%>)getEFactoryInstance();
723 }
724 <%} else {%>
725 <%=genPackage.getFactoryInterfaceName()%> get<%=genPackage.getFactoryName()%>();
726 <%}%>
727
728 <%if (isImplementation) {%>
729 <%if (!genPackage.isLoadedInitialization()) {%>
730 /**
731 * <!-- begin-user-doc -->
732 * <!-- end-user-doc -->
733 * @generated
734 */
735 private boolean isCreated = false;
736
737 /**
738 * Creates the meta-model objects for the package. This method is
739 * guarded to have no affect on any invocation but its first.
740 * <!-- begin-user-doc -->
741 * <!-- end-user-doc -->
742 * @generated
743 */
744 <%{boolean needsSuppressDeprecation = false; if (!packageNeedsSuppressDeprecation && isJDK50 && !genModel.isSuppressEMFMetaData()) { LOOP: for (GenClass genClass : genPackage.getGenClasses()) { for (GenFeature genFeature : genClass.getGenFeatures()) { if (genFeature.hasAPIDeprecatedTag()) { needsSuppressDeprecation = true; break LOOP; }}
745 for (GenOperation genOperation : genClass.getGenOperations()) { if (genOperation.hasAPIDeprecatedTag()) { needsSuppressDeprecation = true; break LOOP; }}} if (needsSuppressDeprecation) {%>
746 @SuppressWarnings("deprecation")
747 <%}}}%>
748 public void createPackageContents()
749 {
750 if (isCreated) return;
751 isCreated = true;
752 <%if (!genPackage.getGenClasses().isEmpty()) {%>
753
754 // Create classes and their features
755 <%for (Iterator<GenClass> c=genPackage.getGenClasses().iterator(); c.hasNext();) { GenClass genClass = c.next();%>
756 <%=genClass.getClassifierInstanceName()%> = create<%=genClass.getMetaType()%>(<%=genClass.getClassifierID()%>);
757 <%for (GenFeature genFeature : genClass.getGenFeatures()) {%>
758 create<%=genFeature.getMetaType()%>(<%=genClass.getClassifierInstanceName()%>, <%=genClass.getFeatureID(genFeature)%>);
759 <%}%>
760 <%if (genModel.isOperationReflection()) {%>
761 <%for (GenOperation genOperation : genClass.getGenOperations()) {%>
762 createEOperation(<%=genClass.getClassifierInstanceName()%>, <%=genClass.getOperationID(genOperation, false)%>);
763 <%}%>
764 <%}%>
765 <%if (c.hasNext()) {%>
766
767 <%}%>
768 <%}%>
769 <%}%>
770 <%if (!genPackage.getGenEnums().isEmpty()) {%>
771
772 // Create enums
773 <%for (GenEnum genEnum : genPackage.getGenEnums()) {%>
774 <%=genEnum.getClassifierInstanceName()%> = createEEnum(<%=genEnum.getClassifierID()%>);
775 <%}%>
776 <%}%>
777 <%if (!genPackage.getGenDataTypes().isEmpty()) {%>
778
779 // Create data types
780 <%for (GenDataType genDataType : genPackage.getGenDataTypes()) {%>
781 <%=genDataType.getClassifierInstanceName()%> = createEDataType(<%=genDataType.getClassifierID()%>);
782 <%}%>
783 <%}%>
784 }
785
786 /**
787 * <!-- begin-user-doc -->
788 * <!-- end-user-doc -->
789 * @generated
790 */
791 private boolean isInitialized = false;
792
793 <%
794 ///////////////////////
795 class Information
796 {
797 @SuppressWarnings("unused")
798 EGenericType eGenericType;
799 int depth;
800 String type;
801 String accessor;
802 }
803
804 class InformationIterator
805 {
806 Iterator<Object> iterator;
807 InformationIterator(EGenericType eGenericType)
808 {
809 iterator = EcoreUtil.getAllContents(Collections.singleton(eGenericType));
810 }
811
812 boolean hasNext()
813 {
814 return iterator.hasNext();
815 }
816
817 Information next()
818 {
819 Information information = new Information();
820 EGenericType eGenericType = information.eGenericType = (EGenericType)iterator.next();
821 for (EObject container = eGenericType.eContainer(); container instanceof EGenericType; container = container.eContainer())
822 {
823 ++information.depth;
824 }
825 if (eGenericType.getEClassifier() != null )
826 {
827 GenClassifier genClassifier = genModel.findGenClassifier(eGenericType.getEClassifier());
828 information.type = genPackage.getPackageInstanceVariable(genClassifier.getGenPackage()) + ".get" + genClassifier.getClassifierAccessorName() + "()";
829 }
830 else if (eGenericType.getETypeParameter() != null)
831 {
832 ETypeParameter eTypeParameter = eGenericType.getETypeParameter();
833 if (eTypeParameter.eContainer() instanceof EClass)
834 {
835 information.type = genModel.findGenClassifier((EClass)eTypeParameter.eContainer()).getClassifierInstanceName() + "_" + eGenericType.getETypeParameter().getName();
836 }
837 else
838 {
839 information.type = "t" + (((EOperation)eTypeParameter.eContainer()).getETypeParameters().indexOf(eTypeParameter) + 1);
840 }
841 }
842 else
843 {
844 information.type ="";
845 }
846 if (information.depth > 0)
847 {
848 if (eGenericType.eContainmentFeature().isMany())
849 {
850 information.accessor = "getE" + eGenericType.eContainmentFeature().getName().substring(1) + "().add";
851 }
852 else
853 {
854 information.accessor = "setE" + eGenericType.eContainmentFeature().getName().substring(1);
855 }
856 }
857 return information;
858 }
859 }
860 ///////////////////////
861 int maxGenericTypeAssignment = 0;
862 %>
863 /**
864 * Complete the initialization of the package and its meta-model. This
865 * method is guarded to have no affect on any invocation but its first.
866 * <!-- begin-user-doc -->
867 * <!-- end-user-doc -->
868 * @generated
869 */
870 <%{boolean needsSuppressDeprecation = false; if (!packageNeedsSuppressDeprecation && isJDK50) { LOOP: for (GenEnum genEnum : genPackage.getGenEnums()) { for (GenEnumLiteral genEnumLiteral : genEnum.getGenEnumLiterals()) { if (genEnumLiteral.hasAPIDeprecatedTag()) { needsSuppressDeprecation = true; break LOOP; }}} if (needsSuppressDeprecation) {%>
871 @SuppressWarnings("deprecation")
872 <%}}}%>
873 public void initializePackageContents()
874 {
875 if (isInitialized) return;
876 isInitialized = true;
877
878 // Initialize package
879 setName(eNAME);
880 setNsPrefix(eNS_PREFIX);
881 setNsURI(eNS_URI);
882 <%if (!genPackage.getPackageInitializationDependencies().isEmpty()) {%>
883
884 // Obtain other dependent packages
885 <%for (GenPackage dep : genPackage.getPackageInitializationDependencies()) {%>
886 <%=dep.getImportedPackageInterfaceName()%> <%=genPackage.getPackageInstanceVariable(dep)%> = (<%=dep.getImportedPackageInterfaceName()%>)<%=genModel.getImportedName("org.eclipse.emf.ecore.EPackage")%>.Registry.INSTANCE.getEPackage(<%=dep.getImportedPackageInterfaceName()%>.eNS_URI);
887 <%}%>
888 <%}%>
889 <%if (!genPackage.getSubGenPackages().isEmpty()) {%>
890
891 // Add subpackages
892 <%for (GenPackage sub : genPackage.getSubGenPackages()) {%>
893 getESubpackages().add(<%=genPackage.getPackageInstanceVariable(sub)%>);
894 <%}%>
895 <%}%>
896 <%if (!genPackage.getGenClasses().isEmpty()) { boolean firstOperationAssignment = true; int maxTypeParameterAssignment = 0;%>
897 <%if (genModel.useGenerics()) {%>
898
899 // Create type parameters
900 <%for (GenClassifier genClassifier : genPackage.getGenClassifiers()) {%>
901 <%for (GenTypeParameter genTypeParameter : genClassifier.getGenTypeParameters()) {%>
902 <%if (!genTypeParameter.getEcoreTypeParameter().getEBounds().isEmpty() || genTypeParameter.isUsed()) {%>
903 <%=genModel.getImportedName("org.eclipse.emf.ecore.ETypeParameter")%> <%=genClassifier.getClassifierInstanceName()%>_<%=genTypeParameter.getName()%> = addETypeParameter(<%=genClassifier.getClassifierInstanceName()%>, "<%=genTypeParameter.getName()%>");<%=genModel.getNonNLS()%>
904 <%} else {%>
905 addETypeParameter(<%=genClassifier.getClassifierInstanceName()%>, "<%=genTypeParameter.getName()%>");<%=genModel.getNonNLS()%>
906 <%}%>
907 <%}%>
908 <%}%>
909 <%}%>
910 <%if (genModel.useGenerics()) {%>
911
912 // Set bounds for type parameters
913 <%for (GenClassifier genClassifier : genPackage.getGenClassifiers()) {%>
914 <%for (GenTypeParameter genTypeParameter : genClassifier.getGenTypeParameters()) {%>
915 <%for (EGenericType bound : genTypeParameter.getEcoreTypeParameter().getEBounds()) {%>
916 <%for (InformationIterator i=new InformationIterator(bound); i.hasNext(); ) { Information info = i.next(); String prefix = ""; if (maxGenericTypeAssignment <= info.depth) { ++maxGenericTypeAssignment; prefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>
917 <%=prefix%>g<%=info.depth + 1%> = createEGenericType(<%=info.type%>);
918 <%if (info.depth > 0) {%>
919 g<%=info.depth%>.<%=info.accessor%>(g<%=info.depth + 1%>);
920 <%}%>
921 <%}%>
922 <%=genClassifier.getClassifierInstanceName()%>_<%=genTypeParameter.getName()%>.getEBounds().add(g1);
923 <%}%>
924 <%}%>
925 <%}%>
926 <%}%>
927
928 // Add supertypes to classes
929 <%for (GenClass genClass : genPackage.getGenClasses()) {%>
930 <%if (!genClass.hasGenericSuperTypes()) {%>
931 <%for (GenClass baseGenClass : genClass.getBaseGenClasses()) {%>
932 <%=genClass.getClassifierInstanceName()%>.getESuperTypes().add(<%=genPackage.getPackageInstanceVariable(baseGenClass.getGenPackage())%>.get<%=baseGenClass.getClassifierAccessorName()%>());
933 <%}%>
934 <%} else {%>
935 <%for (EGenericType superType : genClass.getEcoreClass().getEGenericSuperTypes()) {%>
936 <%for (InformationIterator i=new InformationIterator(superType); i.hasNext(); ) { Information info = i.next(); String prefix = ""; if (maxGenericTypeAssignment <= info.depth) { ++maxGenericTypeAssignment; prefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>
937 <%=prefix%>g<%=info.depth + 1%> = createEGenericType(<%=info.type%>);
938 <%if (info.depth > 0) {%>
939 g<%=info.depth%>.<%=info.accessor%>(g<%=info.depth + 1%>);
940 <%}%>
941 <%}%>
942 <%=genClass.getClassifierInstanceName()%>.getEGenericSuperTypes().add(g1);
943 <%}%>
944 <%}%>
945 <%}%>
946
947 // Initialize classes<%if (genModel.isOperationReflection()) {%>, features, and operations; add parameters<%} else {%> and features; add operations and parameters<%}%>
948 <%for (Iterator<GenClass> c=genPackage.getGenClasses().iterator(); c.hasNext();) { GenClass genClass = c.next(); boolean hasInstanceTypeName = genModel.useGenerics() && genClass.getEcoreClass().getInstanceTypeName() != null && genClass.getEcoreClass().getInstanceTypeName().contains("<");%>
949 initEClass(<%=genClass.getClassifierInstanceName()%>, <%if (genClass.isDynamic()) {%>null<%} else {%><%=genClass.getRawImportedInterfaceName()%>.class<%}%>, "<%=genClass.getName()%>", <%=genClass.getAbstractFlag()%>, <%=genClass.getInterfaceFlag()%>, <%=genClass.getGeneratedInstanceClassFlag()%><%if (hasInstanceTypeName) {%>, "<%=genClass.getEcoreClass().getInstanceTypeName()%>"<%}%>);<%=genModel.getNonNLS()%><%if (hasInstanceTypeName) {%><%=genModel.getNonNLS(2)%><%}%>
950 <%for (GenFeature genFeature : genClass.getGenFeatures()) {%>
951 <%if (genFeature.hasGenericType()) {%>
952 <%for (InformationIterator i=new InformationIterator(genFeature.getEcoreFeature().getEGenericType()); i.hasNext(); ) { Information info = i.next(); String prefix = ""; if (maxGenericTypeAssignment <= info.depth) { ++maxGenericTypeAssignment; prefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>
953 <%=prefix%>g<%=info.depth + 1%> = createEGenericType(<%=info.type%>);
954 <%if (info.depth > 0) {%>
955 g<%=info.depth%>.<%=info.accessor%>(g<%=info.depth + 1%>);
956 <%}%>
957 <%}%>
958 <%}%>
959 <%if (genFeature.isReferenceType()) { GenFeature reverseGenFeature = genFeature.getReverse();%>
960 <%String reverse = reverseGenFeature == null ? "null" : genPackage.getPackageInstanceVariable(reverseGenFeature.getGenPackage()) + ".get" + reverseGenFeature.getFeatureAccessorName() + "()";%>
961 initEReference(get<%=genFeature.getFeatureAccessorName()%>(), <%if (genFeature.hasGenericType()) {%>g1<%} else {%><%=genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage())%>.get<%=genFeature.getTypeClassifierAccessorName()%>()<%}%>, <%=reverse%>, "<%=genFeature.getName()%>", <%=genFeature.getDefaultValue()%>, <%=genFeature.getLowerBound()%>, <%=genFeature.getUpperBound()%>, <%=genFeature.getContainerClass()%>, <%=genFeature.getTransientFlag()%>, <%=genFeature.getVolatileFlag()%>, <%=genFeature.getChangeableFlag()%>, <%=genFeature.getContainmentFlag()%>, <%=genFeature.getResolveProxiesFlag()%>, <%=genFeature.getUnsettableFlag()%>, <%=genFeature.getUniqueFlag()%>, <%=genFeature.getDerivedFlag()%>, <%=genFeature.getOrderedFlag()%>);<%=genModel.getNonNLS()%><%=genModel.getNonNLS(genFeature.getDefaultValue(), 2)%>
962 <%for (GenFeature keyFeature : genFeature.getKeys()) {%>
963 get<%=genFeature.getFeatureAccessorName()%>().getEKeys().add(<%=genPackage.getPackageInstanceVariable(keyFeature.getGenPackage())%>.get<%=keyFeature.getFeatureAccessorName()%>());
964 <%}%>
965 <%} else {%>
966 initEAttribute(get<%=genFeature.getFeatureAccessorName()%>(), <%if (genFeature.hasGenericType()) {%>g1<%} else {%><%=genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage())%>.get<%=genFeature.getTypeClassifierAccessorName()%>()<%}%>, "<%=genFeature.getName()%>", <%=genFeature.getDefaultValue()%>, <%=genFeature.getLowerBound()%>, <%=genFeature.getUpperBound()%>, <%=genFeature.getContainerClass()%>, <%=genFeature.getTransientFlag()%>, <%=genFeature.getVolatileFlag()%>, <%=genFeature.getChangeableFlag()%>, <%=genFeature.getUnsettableFlag()%>, <%=genFeature.getIDFlag()%>, <%=genFeature.getUniqueFlag()%>, <%=genFeature.getDerivedFlag()%>, <%=genFeature.getOrderedFlag()%>);<%=genModel.getNonNLS()%><%=genModel.getNonNLS(genFeature.getDefaultValue(), 2)%>
967 <%}%>
968 <%}%>
969 <%for (GenOperation genOperation : genClass.getGenOperations()) {String prefix = ""; if (genOperation.hasGenericType() || !genOperation.getGenParameters().isEmpty() || !genOperation.getGenExceptions().isEmpty() || !genOperation.getGenTypeParameters().isEmpty()) { if (firstOperationAssignment) { firstOperationAssignment = false; prefix = genModel.getImportedName("org.eclipse.emf.ecore.EOperation") + " op = "; } else { prefix = "op = "; }} %>
970
971 <%if (genModel.useGenerics()) {%>
972 <%=prefix%><%if (genModel.isOperationReflection()) {%>initEOperation(get<%=genOperation.getOperationAccessorName()%>()<%} else {%>addEOperation(<%=genClass.getClassifierInstanceName()%><%}%>, <%if (genOperation.isVoid() || genOperation.hasGenericType()) {%>null<%} else {%><%=genPackage.getPackageInstanceVariable(genOperation.getTypeGenPackage())%>.get<%=genOperation.getTypeClassifierAccessorName()%>()<%}%>, "<%=genOperation.getName()%>", <%=genOperation.getLowerBound()%>, <%=genOperation.getUpperBound()%>, <%=genOperation.getUniqueFlag()%>, <%=genOperation.getOrderedFlag()%>);<%=genModel.getNonNLS()%>
973 <%} else if (!genOperation.isVoid()) {%>
974 <%if (!genOperation.getEcoreOperation().isOrdered() || !genOperation.getEcoreOperation().isUnique()) { needsAddEOperation = true;%>
975 <%=prefix%><%if (genModel.isOperationReflection()) {%>initEOperation(get<%=genOperation.getOperationAccessorName()%>()<%} else {%>addEOperation(<%=genClass.getClassifierInstanceName()%><%}%>, <%=genPackage.getPackageInstanceVariable(genOperation.getTypeGenPackage())%>.get<%=genOperation.getTypeClassifierAccessorName()%>(), "<%=genOperation.getName()%>", <%=genOperation.getLowerBound()%>, <%=genOperation.getUpperBound()%>, <%=genOperation.getUniqueFlag()%>, <%=genOperation.getOrderedFlag()%>);<%=genModel.getNonNLS()%>
976 <%} else {%>
977 <%=prefix%><%if (genModel.isOperationReflection()) {%>initEOperation(get<%=genOperation.getOperationAccessorName()%>()<%} else {%>addEOperation(<%=genClass.getClassifierInstanceName()%><%}%>, <%=genPackage.getPackageInstanceVariable(genOperation.getTypeGenPackage())%>.get<%=genOperation.getTypeClassifierAccessorName()%>(), "<%=genOperation.getName()%>", <%=genOperation.getLowerBound()%>, <%=genOperation.getUpperBound()%>);<%=genModel.getNonNLS()%>
978 <%}%>
979 <%} else {%>
980 <%=prefix%><%if (genModel.isOperationReflection()) {%>initEOperation(get<%=genOperation.getOperationAccessorName()%>()<%} else {%>addEOperation(<%=genClass.getClassifierInstanceName()%><%}%>, null, "<%=genOperation.getName()%>");<%=genModel.getNonNLS()%>
981 <%}%>
982 <%if (genModel.useGenerics()) {%>
983 <%for (ListIterator<GenTypeParameter> t=genOperation.getGenTypeParameters().listIterator(); t.hasNext(); ) { GenTypeParameter genTypeParameter = t.next(); String typeParameterVariable = ""; if (!genTypeParameter.getEcoreTypeParameter().getEBounds().isEmpty() || genTypeParameter.isUsed()) { if (maxTypeParameterAssignment <= t.previousIndex()) { ++maxTypeParameterAssignment; typeParameterVariable = genModel.getImportedName("org.eclipse.emf.ecore.ETypeParameter") + " t" + t.nextIndex() + " = "; } else { typeParameterVariable = "t" + t.nextIndex() + " = "; }} %>
984 <%=typeParameterVariable%>addETypeParameter(op, "<%=genTypeParameter.getName()%>");<%=genModel.getNonNLS()%>
985 <%for (EGenericType typeParameter : genTypeParameter.getEcoreTypeParameter().getEBounds()) {%>
986 <%for (InformationIterator i=new InformationIterator(typeParameter); i.hasNext(); ) { Information info = i.next(); String typePrefix = ""; if (maxGenericTypeAssignment <= info.depth) { ++maxGenericTypeAssignment; typePrefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>
987 <%=typePrefix%>g<%=info.depth + 1%> = createEGenericType(<%=info.type%>);
988 <%if (info.depth > 0) {%>
989 g<%=info.depth%>.<%=info.accessor%>(g<%=info.depth + 1%>);
990 <%}%>
991 <%}%>
992 t<%=t.nextIndex()%>.getEBounds().add(g1);
993 <%}%>
994 <%}%>
995 <%}%>
996 <%for (GenParameter genParameter : genOperation.getGenParameters()) {%>
997 <%if (genParameter.hasGenericType()) {%>
998 <%for (InformationIterator i=new InformationIterator(genParameter.getEcoreParameter().getEGenericType()); i.hasNext(); ) { Information info = i.next(); String typePrefix = ""; if (maxGenericTypeAssignment <= info.depth) { ++maxGenericTypeAssignment; typePrefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>
999 <%=typePrefix%>g<%=info.depth + 1%> = createEGenericType(<%=info.type%>);
1000 <%if (info.depth > 0) {%>
1001 g<%=info.depth%>.<%=info.accessor%>(g<%=info.depth + 1%>);
1002 <%}%>
1003 <%}%>
1004 <%}%>
1005 <%if (genModel.useGenerics()) {%>
1006 addEParameter(op, <%if (genParameter.hasGenericType()){%>g1<%} else {%><%=genPackage.getPackageInstanceVariable(genParameter.getTypeGenPackage())%>.get<%=genParameter.getTypeClassifierAccessorName()%>()<%}%>, "<%=genParameter.getName()%>", <%=genParameter.getLowerBound()%>, <%=genParameter.getUpperBound()%>, <%=genParameter.getUniqueFlag()%>, <%=genParameter.getOrderedFlag()%>);<%=genModel.getNonNLS()%>
1007 <%} else if (!genParameter.getEcoreParameter().isOrdered() || !genParameter.getEcoreParameter().isUnique()) { needsAddEParameter = true;%>
1008 addEParameter(op, <%if (genParameter.hasGenericType()){%>g1<%} else {%><%=genPackage.getPackageInstanceVariable(genParameter.getTypeGenPackage())%>.get<%=genParameter.getTypeClassifierAccessorName()%>()<%}%>, "<%=genParameter.getName()%>", <%=genParameter.getLowerBound()%>, <%=genParameter.getUpperBound()%>, <%=genParameter.getUniqueFlag()%>, <%=genParameter.getOrderedFlag()%>);<%=genModel.getNonNLS()%>
1009 <%} else {%>
1010 addEParameter(op, <%if (genParameter.hasGenericType()){%>g1<%} else {%><%=genPackage.getPackageInstanceVariable(genParameter.getTypeGenPackage())%>.get<%=genParameter.getTypeClassifierAccessorName()%>()<%}%>, "<%=genParameter.getName()%>", <%=genParameter.getLowerBound()%>, <%=genParameter.getUpperBound()%>);<%=genModel.getNonNLS()%>
1011 <%}%>
1012 <%}%>
1013 <%if (genOperation.hasGenericExceptions()) {%>
1014 <%for (EGenericType genericExceptions : genOperation.getEcoreOperation().getEGenericExceptions()) {%>
1015 <%for (InformationIterator i=new InformationIterator(genericExceptions); i.hasNext(); ) { Information info = i.next(); String typePrefix = ""; if (maxGenericTypeAssignment <= info.depth) { ++maxGenericTypeAssignment; typePrefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>
1016 <%=typePrefix%>g<%=info.depth + 1%> = createEGenericType(<%=info.type%>);
1017 <%if (info.depth > 0) {%>
1018 g<%=info.depth%>.<%=info.accessor%>(g<%=info.depth + 1%>);
1019 <%}%>
1020 addEException(op, g<%=info.depth + 1%>);
1021 <%}%>
1022 <%}%>
1023 <%} else {%>
1024 <%for (GenClassifier genException : genOperation.getGenExceptions()) {%>
1025 addEException(op, <%=genPackage.getPackageInstanceVariable(genException.getGenPackage())%>.get<%=genException.getClassifierAccessorName()%>());
1026 <%}%>
1027 <%}%>
1028 <%if (!genOperation.isVoid() && genOperation.hasGenericType()) {%>
1029 <%for (InformationIterator i=new InformationIterator(genOperation.getEcoreOperation().getEGenericType()); i.hasNext(); ) { Information info = i.next(); String typePrefix = ""; if (maxGenericTypeAssignment <= info.depth) { ++maxGenericTypeAssignment; typePrefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>
1030 <%=typePrefix%>g<%=info.depth + 1%> = createEGenericType(<%=info.type%>);
1031 <%if (info.depth > 0) {%>
1032 g<%=info.depth%>.<%=info.accessor%>(g<%=info.depth + 1%>);
1033 <%}%>
1034 <%}%>
1035 initEOperation(op, g1);
1036 <%}%>
1037 <%}%>
1038 <%if (c.hasNext()) {%>
1039
1040 <%}%>
1041 <%}%>
1042 <%}%>
1043 <%if (!genPackage.getGenEnums().isEmpty()) {%>
1044
1045 // Initialize enums and add enum literals
1046 <%for (Iterator<GenEnum> e=genPackage.getGenEnums().iterator(); e.hasNext();) { GenEnum genEnum = e.next();%>
1047 initEEnum(<%=genEnum.getClassifierInstanceName()%>, <%=genEnum.getImportedName()%>.class, "<%=genEnum.getName()%>");<%=genModel.getNonNLS()%>
1048 <%for (GenEnumLiteral genEnumLiteral : genEnum.getGenEnumLiterals()) {%>
1049 addEEnumLiteral(<%=genEnum.getClassifierInstanceName()%>, <%=genEnum.getImportedName().equals(genEnum.getClassifierID()) ? genEnum.getQualifiedName() : genEnum.getImportedName()%>.<%=genEnumLiteral.getEnumLiteralInstanceConstantName()%>);
1050 <%}%>
1051 <%if (e.hasNext()) {%>
1052
1053 <%}%>
1054 <%}%>
1055 <%}%>
1056 <%if (!genPackage.getGenDataTypes().isEmpty()) {%>
1057
1058 // Initialize data types
1059 <%for (GenDataType genDataType : genPackage.getGenDataTypes()) {boolean hasInstanceTypeName = genModel.useGenerics() && genDataType.getEcoreDataType().getInstanceTypeName() != null && genDataType.getEcoreDataType().getInstanceTypeName().contains("<");%>
1060 initEDataType(<%=genDataType.getClassifierInstanceName()%>, <%=genDataType.getRawImportedInstanceClassName()%>.class, "<%=genDataType.getName()%>", <%=genDataType.getSerializableFlag()%>, <%=genDataType.getGeneratedInstanceClassFlag()%><%if (hasInstanceTypeName) {%>, "<%=genDataType.getEcoreDataType().getInstanceTypeName()%>"<%}%>);<%=genModel.getNonNLS()%><%if (hasInstanceTypeName) {%><%=genModel.getNonNLS(2)%><%}%>
1061 <%}%>
1062 <%}%>
1063 <%if (genPackage.getSuperGenPackage() == null) {%>
1064
1065 // Create resource
1066 createResource(<%=genPackage.getSchemaLocation()%>);
1067 <%}%>
1068 <%if (!genPackage.isEcorePackage() && !genPackage.getAnnotationSources().isEmpty()) {%>
1069
1070 // Create annotations
1071 <%for (String annotationSource : genPackage.getAnnotationSources()) {%>
1072 // <%=annotationSource%>
1073 create<%=genPackage.getAnnotationSourceIdentifier(annotationSource)%>Annotations();
1074 <%}%>
1075 <%}%>
1076 }
1077
1078 <%for (String annotationSource : genPackage.getAnnotationSources()) {%>
1079 /**
1080 * Initializes the annotations for <b><%=annotationSource%></b>.
1081 * <!-- begin-user-doc -->
1082 * <!-- end-user-doc -->
1083 * @generated
1084 */
1085 protected void create<%=genPackage.getAnnotationSourceIdentifier(annotationSource)%>Annotations()
1086 {
1087 String source = <%if (annotationSource == null) {%>null;<%} else {%>"<%=annotationSource%>";<%=genModel.getNonNLS()%><%}%>
1088 <%for (EAnnotation eAnnotation : genPackage.getAllAnnotations()) { List<GenPackage.AnnotationReferenceData> annotationReferenceDataList = genPackage.getReferenceData(eAnnotation);%>
1089 <%if (annotationSource == null ? eAnnotation.getSource() == null : annotationSource.equals(eAnnotation.getSource())) {%>
1090 addAnnotation
1091 (<%=genPackage.getAnnotatedModelElementAccessor(eAnnotation)%>,
1092 source,
1093 new String[]
1094 {
1095 <%for (Iterator<Map.Entry<String, String>> k = eAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry<String, String> detail = k.next(); String key = Literals.toStringLiteral(detail.getKey(), genModel); String value = Literals.toStringLiteral(detail.getValue(), genModel);%>
1096 <%=key%>, <%=value%><%=k.hasNext() ? "," : ""%><%=genModel.getNonNLS(key + value)%>
1097 <%}%>
1098 }<%if (annotationReferenceDataList.isEmpty()) {%>);<%} else {%>,<%}%>
1099 <%if (!annotationReferenceDataList.isEmpty()) {%>
1100 new <%=genModel.getImportedName("org.eclipse.emf.common.util.URI")%>[]
1101 {
1102 <%for (Iterator<GenPackage.AnnotationReferenceData> k = annotationReferenceDataList.iterator(); k.hasNext();) { GenPackage.AnnotationReferenceData annotationReferenceData = k.next();%>
1103 <%=genModel.getImportedName("org.eclipse.emf.common.util.URI")%>.createURI(<%if (annotationReferenceData.containingGenPackage != genPackage) {%><%=annotationReferenceData.containingGenPackage.getImportedPackageInterfaceName()%>.<%}%>eNS_URI).appendFragment("<%=annotationReferenceData.uriFragment%>")<%if (k.hasNext()) {%>,<%}%><%=genModel.getNonNLS()%>
1104 <%}%>
1105 });
1106 <%}%>
1107 <%for (EAnnotation nestedEAnnotation : genPackage.getAllNestedAnnotations(eAnnotation)) {String nestedAnnotationSource = nestedEAnnotation.getSource(); int depth = 0; boolean nonContentAnnotation = false; StringBuilder path = new StringBuilder(); for (EObject eContainer = nestedEAnnotation.eContainer(), child = nestedEAnnotation; child != eAnnotation; child = eContainer, eContainer = eContainer.eContainer()) { boolean nonContentChild = child.eContainmentFeature() != EcorePackage.Literals.EANNOTATION__CONTENTS; if (path.length() != 0) { path.insert(0, ", "); } path.insert(0, nonContentChild); if (nonContentChild) { nonContentAnnotation = true; } ++depth; } List<GenPackage.AnnotationReferenceData> nestedAnnotationReferenceDataList = genPackage.getReferenceData(nestedEAnnotation);%>
1108 addAnnotation
1109 (<%=genPackage.getAnnotatedModelElementAccessor(eAnnotation)%>,
1110 <%if (nonContentAnnotation && genModel.getRuntimeVersion().getValue() >= GenRuntimeVersion.EMF210_VALUE) {%>new boolean[] { <%=path.toString()%> }<%} else {%><%=depth%><%}%>,
1111 <%if (nestedAnnotationSource == null) {%>null,<%} else {%>"<%=nestedAnnotationSource%>",<%=genModel.getNonNLS()%><%}%>
1112 new String[]
1113 {
1114 <%for (Iterator<Map.Entry<String, String>> l = nestedEAnnotation.getDetails().iterator(); l.hasNext();) { Map.Entry<String, String> detail = l.next(); String key = Literals.toStringLiteral(detail.getKey(), genModel); String value = Literals.toStringLiteral(detail.getValue(), genModel);%>
1115 <%=key%>, <%=value%><%=l.hasNext() ? "," : ""%><%=genModel.getNonNLS(key + value)%>
1116 <%}%>
1117 }<%if (nestedAnnotationReferenceDataList.isEmpty()) {%>);<%} else {%>,<%}%>
1118 <%if (!nestedAnnotationReferenceDataList.isEmpty()) {%>
1119 new <%=genModel.getImportedName("org.eclipse.emf.common.util.URI")%>[]
1120 {
1121 <%for (Iterator<GenPackage.AnnotationReferenceData> l = nestedAnnotationReferenceDataList.iterator(); l.hasNext();) { GenPackage.AnnotationReferenceData annotationReferenceData = l.next();%>
1122 <%=genModel.getImportedName("org.eclipse.emf.common.util.URI")%>.createURI(<%if (annotationReferenceData.containingGenPackage != genPackage) {%><%=annotationReferenceData.containingGenPackage.getImportedPackageInterfaceName()%>.<%}%>eNS_URI).appendFragment("<%=annotationReferenceData.uriFragment%>")<%if (l.hasNext()) {%>,<%}%><%=genModel.getNonNLS()%>
1123 <%}%>
1124 });
1125 <%}%>
1126 <%}%>
1127 <%}%>
1128 <%}%>
1129 }
1130
1131 <%}%>
1132 <%} else {%>
1133 <%if (genPackage.isLoadingInitialization()) {%>
1134 /**
1135 * <!-- begin-user-doc -->
1136 * <!-- end-user-doc -->
1137 * @generated
1138 */
1139 private boolean isLoaded = false;
1140
1141 /**
1142 * Loads the package and any sub-packages from their serialized form.
1143 * <!-- begin-user-doc -->
1144 * <!-- end-user-doc -->
1145 * @generated
1146 */
1147 public void loadPackage()
1148 {
1149 if (isLoaded) return;
1150 isLoaded = true;
1151
1152 <%=genModel.getImportedName("java.net.URL")%> url = getClass().getResource(packageFilename);
1153 if (url == null)
1154 {
1155 throw new RuntimeException("Missing serialized package: " + packageFilename);<%=genModel.getNonNLS()%>
1156 }
1157 <%=genModel.getImportedName("org.eclipse.emf.common.util.URI")%> uri = <%=genModel.getImportedName("org.eclipse.emf.common.util.URI")%>.createURI(url.toString());
1158 <%=genModel.getImportedName("org.eclipse.emf.ecore.resource.Resource")%> resource = new <%=genModel.getImportedName("org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl")%>().createResource(uri);
1159 try
1160 {
1161 resource.load(<%if ("ebin".equals(genPackage.getLoadInitializationFileExtension())) {%><%=genModel.getImportedName("java.util.Collections")%>.singletonMap(<%=genModel.getImportedName("org.eclipse.emf.ecore.xmi.XMLResource")%>.OPTION_BINARY, Boolean.TRUE)<%} else {%>null<%}%>);
1162 }
1163 catch (<%=genModel.getImportedName("java.io.IOException")%> exception)
1164 {
1165 throw new <%=genModel.getImportedName("org.eclipse.emf.common.util.WrappedException")%>(exception);
1166 }
1167 initializeFromLoadedEPackage(this, (<%=genModel.getImportedName("org.eclipse.emf.ecore.EPackage")%>)resource.getContents().get(0));
1168 createResource(eNS_URI);
1169 }
1170
1171 <%}%>
1172
1173 /**
1174 * <!-- begin-user-doc -->
1175 * <!-- end-user-doc -->
1176 * @generated
1177 */
1178 private boolean isFixed = false;
1179
1180 /**
1181 * Fixes up the loaded package, to make it appear as if it had been programmatically built.
1182 * <!-- begin-user-doc -->
1183 * <!-- end-user-doc -->
1184 * @generated
1185 */
1186 public void fixPackageContents()
1187 {
1188 if (isFixed) return;
1189 isFixed = true;
1190 fixEClassifiers();
1191 }
1192
1193 /**
1194 * Sets the instance class on the given classifier.
1195 * <!-- begin-user-doc -->
1196 * <!-- end-user-doc -->
1197 * @generated
1198 */
1199 <%if (genModel.useClassOverrideAnnotation()) {%>
1200 @Override
1201 <%}%>
1202 protected void fixInstanceClass(<%=genModel.getImportedName("org.eclipse.emf.ecore.EClassifier")%> eClassifier)
1203 {
1204 if (eClassifier.getInstanceClassName() == null)
1205 {
1206 <%ArrayList<GenClass> dynamicGenClasses = new ArrayList<GenClass>(); for (GenClass genClass : genPackage.getGenClasses()) { if (genClass.isDynamic()) { dynamicGenClasses.add(genClass); } }%>
1207 <%if (dynamicGenClasses.isEmpty()) {%>
1208 eClassifier.setInstanceClassName("<%=genPackage.getInterfacePackageName()%>." + eClassifier.getName());<%=genModel.getNonNLS()%>
1209 setGeneratedClassName(eClassifier);
1210 <%} else {%>
1211 switch (eClassifier.getClassifierID())
1212 {
1213 <%for (GenClass genClass : dynamicGenClasses) {%>
1214 <%if (genClass.isDynamic()) {%>
1215 case <%=genPackage.getClassifierID(genClass)%>:
1216 <%}%>
1217 <%}%>
1218 {
1219 break;
1220 }
1221 default:
1222 {
1223 eClassifier.setInstanceClassName("<%=genPackage.getInterfacePackageName()%>." + eClassifier.getName());<%=genModel.getNonNLS()%>
1224 setGeneratedClassName(eClassifier);
1225 break;
1226 }
1227 }
1228 <%}%>
1229 }
1230 }
1231
1232 <%}%>
1233 <%if (needsAddEOperation) {%>
1234 /**
1235 * <!-- begin-user-doc -->
1236 * <!-- end-user-doc -->
1237 * @generated
1238 */
1239 protected <%=genModel.getImportedName("org.eclipse.emf.ecore.EOperation")%> addEOperation(<%=genModel.getImportedName("org.eclipse.emf.ecore.EClass")%> owner, <%=genModel.getImportedName("org.eclipse.emf.ecore.EClassifier")%> type, String name, int lowerBound, int upperBound, boolean isUnique, boolean isOrdered)
1240 {
1241 <%=genModel.getImportedName("org.eclipse.emf.ecore.EOperation")%> o = addEOperation(owner, type, name, lowerBound, upperBound);
1242 o.setUnique(isUnique);
1243 o.setOrdered(isOrdered);
1244 return o;
1245 }
1246
1247 <%}%>
1248 <%if (needsAddEParameter) {%>
1249 /**
1250 * <!-- begin-user-doc -->
1251 * <!-- end-user-doc -->
1252 * @generated
1253 */
1254 protected <%=genModel.getImportedName("org.eclipse.emf.ecore.EParameter")%> addEParameter(<%=genModel.getImportedName("org.eclipse.emf.ecore.EOperation")%> owner, <%=genModel.getImportedName("org.eclipse.emf.ecore.EClassifier")%> type, String name, int lowerBound, int upperBound, boolean isUnique, boolean isOrdered)
1255 {
1256 <%=genModel.getImportedName("org.eclipse.emf.ecore.EParameter")%> p = ecoreFactory.createEParameter();
1257 p.setEType(type);
1258 p.setName(name);
1259 p.setLowerBound(lowerBound);
1260 p.setUpperBound(upperBound);
1261 p.setUnique(isUnique);
1262 p.setOrdered(isOrdered);
1263 owner.getEParameters().add(p);
1264 return p;
1265 }
1266
1267 <%}%>
1268 <%}%>
1269 <%if (isInterface && genPackage.isLiteralsInterface()) {%>
1270 /**
1271 * <!-- begin-user-doc -->
1272 * Defines literals for the meta objects that represent
1273 * <ul>
1274 * <li>each class,</li>
1275 * <li>each feature of each class,</li>
1276 <%if (genModel.isOperationReflection()) {%>
1277 * <li>each operation of each class,</li>
1278 <%}%>
1279 * <li>each enum,</li>
1280 * <li>and each data type</li>
1281 * </ul>
1282 * <!-- end-user-doc -->
1283 * @generated
1284 */
1285 <%if (isImplementation) {%>public <%}%>interface Literals
1286 {
1287 <%for (GenClassifier genClassifier : genPackage.getGenClassifiers()) {%>
1288 /**
1289 <%if (genClassifier instanceof GenClass) { GenClass genClass = (GenClass)genClassifier;%>
1290 <%if (!genClass.isInterface()) {%>
1291 * The meta object literal for the '{@link <%=genClass.getQualifiedClassName()%> <em><%=genClass.getFormattedName()%></em>}' class.
1292 * <!-- begin-user-doc -->
1293 * <!-- end-user-doc -->
1294 * @see <%=genClass.getQualifiedClassName()%>
1295 <%} else {%>
1296 * The meta object literal for the '{@link <%=genClass.getRawQualifiedInterfaceName()%> <em><%=genClass.getFormattedName()%></em>}' class.
1297 * <!-- begin-user-doc -->
1298 * <!-- end-user-doc -->
1299 * @see <%=genClass.getRawQualifiedInterfaceName()%>
1300 <%}%>
1301 <%} else if (genClassifier instanceof GenEnum) { GenEnum genEnum = (GenEnum)genClassifier;%>
1302 * The meta object literal for the '{@link <%=genEnum.getQualifiedName()%> <em><%=genEnum.getFormattedName()%></em>}' enum.
1303 * <!-- begin-user-doc -->
1304 * <!-- end-user-doc -->
1305 * @see <%=genEnum.getQualifiedName()%>
1306 <%} else if (genClassifier instanceof GenDataType) { GenDataType genDataType = (GenDataType)genClassifier;%>
1307 * The meta object literal for the '<em><%=genDataType.getFormattedName()%></em>' data type.
1308 * <!-- begin-user-doc -->
1309 * <!-- end-user-doc -->
1310 <%if (!genDataType.isPrimitiveType() && !genDataType.isArrayType()) {%>
1311 * @see <%=genDataType.getRawInstanceClassName()%>
1312 <%}%>
1313 <%}%>
1314 * @see <%=genPackage.getQualifiedPackageClassName()%>#get<%=genClassifier.getClassifierAccessorName()%>()
1315 <%if (genClassifier.hasAPITags()) {%>
1316 * <%=genClassifier.getAPITags(genModel.getIndentation(stringBuffer))%>
1317 <%}%>
1318 * @generated
1319 */
1320 <%if (isJDK50 && genClassifier.hasAPIDeprecatedTag()) {%>
1321 @Deprecated
1322 <%}%>
1323 <%=publicStaticFinalFlag%><%=genClassifier.getImportedMetaType()%> <%=genPackage.getClassifierID(genClassifier)%> = eINSTANCE.get<%=genClassifier.getClassifierAccessorName()%>();
1324
1325 <%if (genClassifier instanceof GenClass) { GenClass genClass = (GenClass)genClassifier;%>
1326 <%for (GenFeature genFeature : genClass.getGenFeatures()) {%>
1327 /**
1328 * The meta object literal for the '<em><b><%=genFeature.getFormattedName()%></b></em>' <%=genFeature.getFeatureKind()%> feature.
1329 * <!-- begin-user-doc -->
1330 * <!-- end-user-doc -->
1331 <%if (genFeature.hasImplicitAPITags()) {%>
1332 * <%=genFeature.getImplicitAPITags(genModel.getIndentation(stringBuffer))%>
1333 <%}%>
1334 * @generated
1335 */
1336 <%if (isJDK50 && genFeature.hasImplicitAPIDeprecatedTag()) {%>
1337 @Deprecated
1338 <%}%>
1339 <%=publicStaticFinalFlag%><%=genFeature.getImportedMetaType()%> <%=genClass.getFeatureID(genFeature)%> = eINSTANCE.get<%=genFeature.getFeatureAccessorName()%>();
1340
1341 <%}%>
1342 <%if (genModel.isOperationReflection()) {%>
1343 <%for (GenOperation genOperation : genClass.getGenOperations()) {%>
1344 /**
1345 * The meta object literal for the '<em><b><%=genOperation.getFormattedName()%></b></em>' operation.
1346 * <!-- begin-user-doc -->
1347 * <!-- end-user-doc -->
1348 <%if (genOperation.hasImplicitAPITags()) {%>
1349 * <%=genOperation.getImplicitAPITags(genModel.getIndentation(stringBuffer))%>
1350 <%}%>
1351 * @generated
1352 */
1353 <%if (isJDK50 && genOperation.hasImplicitAPIDeprecatedTag()) {%>
1354 @Deprecated
1355 <%}%>
1356 <%=publicStaticFinalFlag%><%=genOperation.getImportedMetaType()%> <%=genClass.getOperationID(genOperation, false)%> = eINSTANCE.get<%=genOperation.getOperationAccessorName()%>();
1357
1358 <%}%>
1359 <%}%>
1360 <%}%>
1361 <%}%>
1362 }
1363
1364 <%}%>
1365 } //<%=isInterface ? genPackage.getPackageInterfaceName() : genPackage.getPackageClassName()%>
1366 <%genModel.emitSortedImports();%>