1 /**
2 * <copyright>
3 * </copyright>
4 *
5 * $Id$
6 */
7 package org.mod4j.dsl.datacontract.mm.DataContractDsl.util;
8
9 import java.util.List;
10
11 import org.eclipse.emf.ecore.EClass;
12 import org.eclipse.emf.ecore.EObject;
13
14 import org.mod4j.dsl.datacontract.mm.DataContractDsl.*;
15
16 /**
17 * <!-- begin-user-doc -->
18 * The <b>Switch</b> for the model's inheritance hierarchy.
19 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
20 * to invoke the <code>caseXXX</code> method for each class of the model,
21 * starting with the actual class of the object
22 * and proceeding up the inheritance hierarchy
23 * until a non-null result is returned,
24 * which is the result of the switch.
25 * <!-- end-user-doc -->
26 * @see org.mod4j.dsl.datacontract.mm.DataContractDsl.DataContractDslPackage
27 * @generated
28 */
29 public class DataContractDslSwitch<T> {
30 /**
31 * The cached model package
32 * <!-- begin-user-doc -->
33 * <!-- end-user-doc -->
34 * @generated
35 */
36 protected static DataContractDslPackage modelPackage;
37
38 /**
39 * Creates an instance of the switch.
40 * <!-- begin-user-doc -->
41 * <!-- end-user-doc -->
42 * @generated
43 */
44 public DataContractDslSwitch() {
45 if (modelPackage == null) {
46 modelPackage = DataContractDslPackage.eINSTANCE;
47 }
48 }
49
50 /**
51 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
52 * <!-- begin-user-doc -->
53 * <!-- end-user-doc -->
54 * @return the first non-null result returned by a <code>caseXXX</code> call.
55 * @generated
56 */
57 public T doSwitch(EObject theEObject) {
58 return doSwitch(theEObject.eClass(), theEObject);
59 }
60
61 /**
62 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
63 * <!-- begin-user-doc -->
64 * <!-- end-user-doc -->
65 * @return the first non-null result returned by a <code>caseXXX</code> call.
66 * @generated
67 */
68 protected T doSwitch(EClass theEClass, EObject theEObject) {
69 if (theEClass.eContainer() == modelPackage) {
70 return doSwitch(theEClass.getClassifierID(), theEObject);
71 }
72 else {
73 List<EClass> eSuperTypes = theEClass.getESuperTypes();
74 return
75 eSuperTypes.isEmpty() ?
76 defaultCase(theEObject) :
77 doSwitch(eSuperTypes.get(0), theEObject);
78 }
79 }
80
81 /**
82 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
83 * <!-- begin-user-doc -->
84 * <!-- end-user-doc -->
85 * @return the first non-null result returned by a <code>caseXXX</code> call.
86 * @generated
87 */
88 protected T doSwitch(int classifierID, EObject theEObject) {
89 switch (classifierID) {
90 case DataContractDslPackage.DATA_CONTRACT_MODEL: {
91 DataContractModel dataContractModel = (DataContractModel)theEObject;
92 T result = caseDataContractModel(dataContractModel);
93 if (result == null) result = caseModelElement(dataContractModel);
94 if (result == null) result = defaultCase(theEObject);
95 return result;
96 }
97 case DataContractDslPackage.DTO: {
98 Dto dto = (Dto)theEObject;
99 T result = caseDto(dto);
100 if (result == null) result = caseModelElement(dto);
101 if (result == null) result = defaultCase(theEObject);
102 return result;
103 }
104 case DataContractDslPackage.BUSINESS_CLASS_DTO: {
105 BusinessClassDto businessClassDto = (BusinessClassDto)theEObject;
106 T result = caseBusinessClassDto(businessClassDto);
107 if (result == null) result = caseDto(businessClassDto);
108 if (result == null) result = caseModelElement(businessClassDto);
109 if (result == null) result = defaultCase(theEObject);
110 return result;
111 }
112 case DataContractDslPackage.DTO_PROPERTY: {
113 DtoProperty dtoProperty = (DtoProperty)theEObject;
114 T result = caseDtoProperty(dtoProperty);
115 if (result == null) result = caseModelElement(dtoProperty);
116 if (result == null) result = defaultCase(theEObject);
117 return result;
118 }
119 case DataContractDslPackage.DTO_DATA_PROPERTY: {
120 DtoDataProperty dtoDataProperty = (DtoDataProperty)theEObject;
121 T result = caseDtoDataProperty(dtoDataProperty);
122 if (result == null) result = caseDtoProperty(dtoDataProperty);
123 if (result == null) result = caseModelElement(dtoDataProperty);
124 if (result == null) result = defaultCase(theEObject);
125 return result;
126 }
127 case DataContractDslPackage.DTO_STRING_PROPERTY: {
128 DtoStringProperty dtoStringProperty = (DtoStringProperty)theEObject;
129 T result = caseDtoStringProperty(dtoStringProperty);
130 if (result == null) result = caseDtoDataProperty(dtoStringProperty);
131 if (result == null) result = caseDtoProperty(dtoStringProperty);
132 if (result == null) result = caseModelElement(dtoStringProperty);
133 if (result == null) result = defaultCase(theEObject);
134 return result;
135 }
136 case DataContractDslPackage.DTO_BOOLEAN_PROPERTY: {
137 DtoBooleanProperty dtoBooleanProperty = (DtoBooleanProperty)theEObject;
138 T result = caseDtoBooleanProperty(dtoBooleanProperty);
139 if (result == null) result = caseDtoDataProperty(dtoBooleanProperty);
140 if (result == null) result = caseDtoProperty(dtoBooleanProperty);
141 if (result == null) result = caseModelElement(dtoBooleanProperty);
142 if (result == null) result = defaultCase(theEObject);
143 return result;
144 }
145 case DataContractDslPackage.ENUMERATION_DTO: {
146 EnumerationDto enumerationDto = (EnumerationDto)theEObject;
147 T result = caseEnumerationDto(enumerationDto);
148 if (result == null) result = caseModelElement(enumerationDto);
149 if (result == null) result = defaultCase(theEObject);
150 return result;
151 }
152 case DataContractDslPackage.ENUMERATION_DTO_LITERAL: {
153 EnumerationDtoLiteral enumerationDtoLiteral = (EnumerationDtoLiteral)theEObject;
154 T result = caseEnumerationDtoLiteral(enumerationDtoLiteral);
155 if (result == null) result = caseModelElement(enumerationDtoLiteral);
156 if (result == null) result = defaultCase(theEObject);
157 return result;
158 }
159 case DataContractDslPackage.MODEL_ELEMENT: {
160 ModelElement modelElement = (ModelElement)theEObject;
161 T result = caseModelElement(modelElement);
162 if (result == null) result = defaultCase(theEObject);
163 return result;
164 }
165 case DataContractDslPackage.CUSTOM_DTO: {
166 CustomDto customDto = (CustomDto)theEObject;
167 T result = caseCustomDto(customDto);
168 if (result == null) result = caseDto(customDto);
169 if (result == null) result = caseModelElement(customDto);
170 if (result == null) result = defaultCase(theEObject);
171 return result;
172 }
173 case DataContractDslPackage.DTO_INTEGER_PROPERTY: {
174 DtoIntegerProperty dtoIntegerProperty = (DtoIntegerProperty)theEObject;
175 T result = caseDtoIntegerProperty(dtoIntegerProperty);
176 if (result == null) result = caseDtoDataProperty(dtoIntegerProperty);
177 if (result == null) result = caseDtoProperty(dtoIntegerProperty);
178 if (result == null) result = caseModelElement(dtoIntegerProperty);
179 if (result == null) result = defaultCase(theEObject);
180 return result;
181 }
182 case DataContractDslPackage.DTO_DECIMAL_PROPERTY: {
183 DtoDecimalProperty dtoDecimalProperty = (DtoDecimalProperty)theEObject;
184 T result = caseDtoDecimalProperty(dtoDecimalProperty);
185 if (result == null) result = caseDtoDataProperty(dtoDecimalProperty);
186 if (result == null) result = caseDtoProperty(dtoDecimalProperty);
187 if (result == null) result = caseModelElement(dtoDecimalProperty);
188 if (result == null) result = defaultCase(theEObject);
189 return result;
190 }
191 case DataContractDslPackage.DTO_ENUMERATION_PROPERTY: {
192 DtoEnumerationProperty dtoEnumerationProperty = (DtoEnumerationProperty)theEObject;
193 T result = caseDtoEnumerationProperty(dtoEnumerationProperty);
194 if (result == null) result = caseDtoDataProperty(dtoEnumerationProperty);
195 if (result == null) result = caseDtoProperty(dtoEnumerationProperty);
196 if (result == null) result = caseModelElement(dtoEnumerationProperty);
197 if (result == null) result = defaultCase(theEObject);
198 return result;
199 }
200 case DataContractDslPackage.DTO_DATE_TIME_PROPERTY: {
201 DtoDateTimeProperty dtoDateTimeProperty = (DtoDateTimeProperty)theEObject;
202 T result = caseDtoDateTimeProperty(dtoDateTimeProperty);
203 if (result == null) result = caseDtoDataProperty(dtoDateTimeProperty);
204 if (result == null) result = caseDtoProperty(dtoDateTimeProperty);
205 if (result == null) result = caseModelElement(dtoDateTimeProperty);
206 if (result == null) result = defaultCase(theEObject);
207 return result;
208 }
209 case DataContractDslPackage.BUSINESS_CLASS_PROPERTY_REFERENCE: {
210 BusinessClassPropertyReference businessClassPropertyReference = (BusinessClassPropertyReference)theEObject;
211 T result = caseBusinessClassPropertyReference(businessClassPropertyReference);
212 if (result == null) result = caseModelElement(businessClassPropertyReference);
213 if (result == null) result = defaultCase(theEObject);
214 return result;
215 }
216 case DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE: {
217 BusinessClassAssociationRoleReference businessClassAssociationRoleReference = (BusinessClassAssociationRoleReference)theEObject;
218 T result = caseBusinessClassAssociationRoleReference(businessClassAssociationRoleReference);
219 if (result == null) result = caseModelElement(businessClassAssociationRoleReference);
220 if (result == null) result = defaultCase(theEObject);
221 return result;
222 }
223 case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY: {
224 DtoAssociationRoleProperty dtoAssociationRoleProperty = (DtoAssociationRoleProperty)theEObject;
225 T result = caseDtoAssociationRoleProperty(dtoAssociationRoleProperty);
226 if (result == null) result = caseDtoProperty(dtoAssociationRoleProperty);
227 if (result == null) result = caseModelElement(dtoAssociationRoleProperty);
228 if (result == null) result = defaultCase(theEObject);
229 return result;
230 }
231 case DataContractDslPackage.EXTERNAL_REFERENCE: {
232 ExternalReference externalReference = (ExternalReference)theEObject;
233 T result = caseExternalReference(externalReference);
234 if (result == null) result = caseModelElement(externalReference);
235 if (result == null) result = defaultCase(theEObject);
236 return result;
237 }
238 default: return defaultCase(theEObject);
239 }
240 }
241
242 /**
243 * Returns the result of interpreting the object as an instance of '<em>Data Contract Model</em>'.
244 * <!-- begin-user-doc -->
245 * This implementation returns null;
246 * returning a non-null result will terminate the switch.
247 * <!-- end-user-doc -->
248 * @param object the target of the switch.
249 * @return the result of interpreting the object as an instance of '<em>Data Contract Model</em>'.
250 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
251 * @generated
252 */
253 public T caseDataContractModel(DataContractModel object) {
254 return null;
255 }
256
257 /**
258 * Returns the result of interpreting the object as an instance of '<em>Dto</em>'.
259 * <!-- begin-user-doc -->
260 * This implementation returns null;
261 * returning a non-null result will terminate the switch.
262 * <!-- end-user-doc -->
263 * @param object the target of the switch.
264 * @return the result of interpreting the object as an instance of '<em>Dto</em>'.
265 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
266 * @generated
267 */
268 public T caseDto(Dto object) {
269 return null;
270 }
271
272 /**
273 * Returns the result of interpreting the object as an instance of '<em>Business Class Dto</em>'.
274 * <!-- begin-user-doc -->
275 * This implementation returns null;
276 * returning a non-null result will terminate the switch.
277 * <!-- end-user-doc -->
278 * @param object the target of the switch.
279 * @return the result of interpreting the object as an instance of '<em>Business Class Dto</em>'.
280 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
281 * @generated
282 */
283 public T caseBusinessClassDto(BusinessClassDto object) {
284 return null;
285 }
286
287 /**
288 * Returns the result of interpreting the object as an instance of '<em>Dto Property</em>'.
289 * <!-- begin-user-doc -->
290 * This implementation returns null;
291 * returning a non-null result will terminate the switch.
292 * <!-- end-user-doc -->
293 * @param object the target of the switch.
294 * @return the result of interpreting the object as an instance of '<em>Dto Property</em>'.
295 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
296 * @generated
297 */
298 public T caseDtoProperty(DtoProperty object) {
299 return null;
300 }
301
302 /**
303 * Returns the result of interpreting the object as an instance of '<em>Dto Data Property</em>'.
304 * <!-- begin-user-doc -->
305 * This implementation returns null;
306 * returning a non-null result will terminate the switch.
307 * <!-- end-user-doc -->
308 * @param object the target of the switch.
309 * @return the result of interpreting the object as an instance of '<em>Dto Data Property</em>'.
310 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
311 * @generated
312 */
313 public T caseDtoDataProperty(DtoDataProperty object) {
314 return null;
315 }
316
317 /**
318 * Returns the result of interpreting the object as an instance of '<em>Dto String Property</em>'.
319 * <!-- begin-user-doc -->
320 * This implementation returns null;
321 * returning a non-null result will terminate the switch.
322 * <!-- end-user-doc -->
323 * @param object the target of the switch.
324 * @return the result of interpreting the object as an instance of '<em>Dto String Property</em>'.
325 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
326 * @generated
327 */
328 public T caseDtoStringProperty(DtoStringProperty object) {
329 return null;
330 }
331
332 /**
333 * Returns the result of interpreting the object as an instance of '<em>Dto Boolean Property</em>'.
334 * <!-- begin-user-doc -->
335 * This implementation returns null;
336 * returning a non-null result will terminate the switch.
337 * <!-- end-user-doc -->
338 * @param object the target of the switch.
339 * @return the result of interpreting the object as an instance of '<em>Dto Boolean Property</em>'.
340 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
341 * @generated
342 */
343 public T caseDtoBooleanProperty(DtoBooleanProperty object) {
344 return null;
345 }
346
347 /**
348 * Returns the result of interpreting the object as an instance of '<em>Enumeration Dto</em>'.
349 * <!-- begin-user-doc -->
350 * This implementation returns null;
351 * returning a non-null result will terminate the switch.
352 * <!-- end-user-doc -->
353 * @param object the target of the switch.
354 * @return the result of interpreting the object as an instance of '<em>Enumeration Dto</em>'.
355 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
356 * @generated
357 */
358 public T caseEnumerationDto(EnumerationDto object) {
359 return null;
360 }
361
362 /**
363 * Returns the result of interpreting the object as an instance of '<em>Enumeration Dto Literal</em>'.
364 * <!-- begin-user-doc -->
365 * This implementation returns null;
366 * returning a non-null result will terminate the switch.
367 * <!-- end-user-doc -->
368 * @param object the target of the switch.
369 * @return the result of interpreting the object as an instance of '<em>Enumeration Dto Literal</em>'.
370 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
371 * @generated
372 */
373 public T caseEnumerationDtoLiteral(EnumerationDtoLiteral object) {
374 return null;
375 }
376
377 /**
378 * Returns the result of interpreting the object as an instance of '<em>Model Element</em>'.
379 * <!-- begin-user-doc -->
380 * This implementation returns null;
381 * returning a non-null result will terminate the switch.
382 * <!-- end-user-doc -->
383 * @param object the target of the switch.
384 * @return the result of interpreting the object as an instance of '<em>Model Element</em>'.
385 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
386 * @generated
387 */
388 public T caseModelElement(ModelElement object) {
389 return null;
390 }
391
392 /**
393 * Returns the result of interpreting the object as an instance of '<em>Custom Dto</em>'.
394 * <!-- begin-user-doc -->
395 * This implementation returns null;
396 * returning a non-null result will terminate the switch.
397 * <!-- end-user-doc -->
398 * @param object the target of the switch.
399 * @return the result of interpreting the object as an instance of '<em>Custom Dto</em>'.
400 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
401 * @generated
402 */
403 public T caseCustomDto(CustomDto object) {
404 return null;
405 }
406
407 /**
408 * Returns the result of interpreting the object as an instance of '<em>Dto Integer Property</em>'.
409 * <!-- begin-user-doc -->
410 * This implementation returns null;
411 * returning a non-null result will terminate the switch.
412 * <!-- end-user-doc -->
413 * @param object the target of the switch.
414 * @return the result of interpreting the object as an instance of '<em>Dto Integer Property</em>'.
415 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
416 * @generated
417 */
418 public T caseDtoIntegerProperty(DtoIntegerProperty object) {
419 return null;
420 }
421
422 /**
423 * Returns the result of interpreting the object as an instance of '<em>Dto Decimal Property</em>'.
424 * <!-- begin-user-doc -->
425 * This implementation returns null;
426 * returning a non-null result will terminate the switch.
427 * <!-- end-user-doc -->
428 * @param object the target of the switch.
429 * @return the result of interpreting the object as an instance of '<em>Dto Decimal Property</em>'.
430 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
431 * @generated
432 */
433 public T caseDtoDecimalProperty(DtoDecimalProperty object) {
434 return null;
435 }
436
437 /**
438 * Returns the result of interpreting the object as an instance of '<em>Dto Enumeration Property</em>'.
439 * <!-- begin-user-doc -->
440 * This implementation returns null;
441 * returning a non-null result will terminate the switch.
442 * <!-- end-user-doc -->
443 * @param object the target of the switch.
444 * @return the result of interpreting the object as an instance of '<em>Dto Enumeration Property</em>'.
445 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
446 * @generated
447 */
448 public T caseDtoEnumerationProperty(DtoEnumerationProperty object) {
449 return null;
450 }
451
452 /**
453 * Returns the result of interpreting the object as an instance of '<em>Dto Date Time Property</em>'.
454 * <!-- begin-user-doc -->
455 * This implementation returns null;
456 * returning a non-null result will terminate the switch.
457 * <!-- end-user-doc -->
458 * @param object the target of the switch.
459 * @return the result of interpreting the object as an instance of '<em>Dto Date Time Property</em>'.
460 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
461 * @generated
462 */
463 public T caseDtoDateTimeProperty(DtoDateTimeProperty object) {
464 return null;
465 }
466
467 /**
468 * Returns the result of interpreting the object as an instance of '<em>Business Class Property Reference</em>'.
469 * <!-- begin-user-doc -->
470 * This implementation returns null;
471 * returning a non-null result will terminate the switch.
472 * <!-- end-user-doc -->
473 * @param object the target of the switch.
474 * @return the result of interpreting the object as an instance of '<em>Business Class Property Reference</em>'.
475 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
476 * @generated
477 */
478 public T caseBusinessClassPropertyReference(BusinessClassPropertyReference object) {
479 return null;
480 }
481
482 /**
483 * Returns the result of interpreting the object as an instance of '<em>Business Class Association Role Reference</em>'.
484 * <!-- begin-user-doc -->
485 * This implementation returns null;
486 * returning a non-null result will terminate the switch.
487 * <!-- end-user-doc -->
488 * @param object the target of the switch.
489 * @return the result of interpreting the object as an instance of '<em>Business Class Association Role Reference</em>'.
490 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
491 * @generated
492 */
493 public T caseBusinessClassAssociationRoleReference(BusinessClassAssociationRoleReference object) {
494 return null;
495 }
496
497 /**
498 * Returns the result of interpreting the object as an instance of '<em>Dto Association Role Property</em>'.
499 * <!-- begin-user-doc -->
500 * This implementation returns null;
501 * returning a non-null result will terminate the switch.
502 * <!-- end-user-doc -->
503 * @param object the target of the switch.
504 * @return the result of interpreting the object as an instance of '<em>Dto Association Role Property</em>'.
505 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
506 * @generated
507 */
508 public T caseDtoAssociationRoleProperty(DtoAssociationRoleProperty object) {
509 return null;
510 }
511
512 /**
513 * Returns the result of interpreting the object as an instance of '<em>External Reference</em>'.
514 * <!-- begin-user-doc -->
515 * This implementation returns null;
516 * returning a non-null result will terminate the switch.
517 * <!-- end-user-doc -->
518 * @param object the target of the switch.
519 * @return the result of interpreting the object as an instance of '<em>External Reference</em>'.
520 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
521 * @generated
522 */
523 public T caseExternalReference(ExternalReference object) {
524 return null;
525 }
526
527 /**
528 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
529 * <!-- begin-user-doc -->
530 * This implementation returns null;
531 * returning a non-null result will terminate the switch, but this is the last case anyway.
532 * <!-- end-user-doc -->
533 * @param object the target of the switch.
534 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
535 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
536 * @generated
537 */
538 public T defaultCase(EObject object) {
539 return null;
540 }
541
542 } //DataContractDslSwitch