1 /**
2 * <copyright>
3 * </copyright>
4 *
5 * $Id$
6 */
7 package org.mod4j.dsl.service.mm.ServiceDsl.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.service.mm.ServiceDsl.*;
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.service.mm.ServiceDsl.ServiceDslPackage
27 * @generated
28 */
29 public class ServiceDslSwitch<T> {
30 /**
31 * The cached model package
32 * <!-- begin-user-doc -->
33 * <!-- end-user-doc -->
34 * @generated
35 */
36 protected static ServiceDslPackage modelPackage;
37
38 /**
39 * Creates an instance of the switch.
40 * <!-- begin-user-doc -->
41 * <!-- end-user-doc -->
42 * @generated
43 */
44 public ServiceDslSwitch() {
45 if (modelPackage == null) {
46 modelPackage = ServiceDslPackage.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 ServiceDslPackage.SERVICE_MODEL: {
91 ServiceModel serviceModel = (ServiceModel)theEObject;
92 T result = caseServiceModel(serviceModel);
93 if (result == null) result = caseModelElement(serviceModel);
94 if (result == null) result = defaultCase(theEObject);
95 return result;
96 }
97 case ServiceDslPackage.MODEL_ELEMENT: {
98 ModelElement modelElement = (ModelElement)theEObject;
99 T result = caseModelElement(modelElement);
100 if (result == null) result = defaultCase(theEObject);
101 return result;
102 }
103 case ServiceDslPackage.DTO_REFERENCE: {
104 DtoReference dtoReference = (DtoReference)theEObject;
105 T result = caseDtoReference(dtoReference);
106 if (result == null) result = caseModelElement(dtoReference);
107 if (result == null) result = defaultCase(theEObject);
108 return result;
109 }
110 case ServiceDslPackage.CUSTOM_METHOD: {
111 CustomMethod customMethod = (CustomMethod)theEObject;
112 T result = caseCustomMethod(customMethod);
113 if (result == null) result = caseServiceMethod(customMethod);
114 if (result == null) result = caseModelElement(customMethod);
115 if (result == null) result = defaultCase(theEObject);
116 return result;
117 }
118 case ServiceDslPackage.CRUD_SERVICE: {
119 CrudService crudService = (CrudService)theEObject;
120 T result = caseCrudService(crudService);
121 if (result == null) result = caseModelElement(crudService);
122 if (result == null) result = defaultCase(theEObject);
123 return result;
124 }
125 case ServiceDslPackage.SPECIAL_METHOD: {
126 SpecialMethod specialMethod = (SpecialMethod)theEObject;
127 T result = caseSpecialMethod(specialMethod);
128 if (result == null) result = caseServiceMethod(specialMethod);
129 if (result == null) result = caseModelElement(specialMethod);
130 if (result == null) result = defaultCase(theEObject);
131 return result;
132 }
133 case ServiceDslPackage.SERVICE_METHOD: {
134 ServiceMethod serviceMethod = (ServiceMethod)theEObject;
135 T result = caseServiceMethod(serviceMethod);
136 if (result == null) result = caseModelElement(serviceMethod);
137 if (result == null) result = defaultCase(theEObject);
138 return result;
139 }
140 case ServiceDslPackage.PARAMETER: {
141 Parameter parameter = (Parameter)theEObject;
142 T result = caseParameter(parameter);
143 if (result == null) result = caseModelElement(parameter);
144 if (result == null) result = defaultCase(theEObject);
145 return result;
146 }
147 case ServiceDslPackage.ASSOCIATION_METHOD: {
148 AssociationMethod associationMethod = (AssociationMethod)theEObject;
149 T result = caseAssociationMethod(associationMethod);
150 if (result == null) result = caseServiceMethod(associationMethod);
151 if (result == null) result = caseModelElement(associationMethod);
152 if (result == null) result = defaultCase(theEObject);
153 return result;
154 }
155 default: return defaultCase(theEObject);
156 }
157 }
158
159 /**
160 * Returns the result of interpreting the object as an instance of '<em>Service Model</em>'.
161 * <!-- begin-user-doc -->
162 * This implementation returns null;
163 * returning a non-null result will terminate the switch.
164 * <!-- end-user-doc -->
165 * @param object the target of the switch.
166 * @return the result of interpreting the object as an instance of '<em>Service Model</em>'.
167 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
168 * @generated
169 */
170 public T caseServiceModel(ServiceModel object) {
171 return null;
172 }
173
174 /**
175 * Returns the result of interpreting the object as an instance of '<em>Model Element</em>'.
176 * <!-- begin-user-doc -->
177 * This implementation returns null;
178 * returning a non-null result will terminate the switch.
179 * <!-- end-user-doc -->
180 * @param object the target of the switch.
181 * @return the result of interpreting the object as an instance of '<em>Model Element</em>'.
182 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
183 * @generated
184 */
185 public T caseModelElement(ModelElement object) {
186 return null;
187 }
188
189 /**
190 * Returns the result of interpreting the object as an instance of '<em>Dto Reference</em>'.
191 * <!-- begin-user-doc -->
192 * This implementation returns null;
193 * returning a non-null result will terminate the switch.
194 * <!-- end-user-doc -->
195 * @param object the target of the switch.
196 * @return the result of interpreting the object as an instance of '<em>Dto Reference</em>'.
197 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
198 * @generated
199 */
200 public T caseDtoReference(DtoReference object) {
201 return null;
202 }
203
204 /**
205 * Returns the result of interpreting the object as an instance of '<em>Custom Method</em>'.
206 * <!-- begin-user-doc -->
207 * This implementation returns null;
208 * returning a non-null result will terminate the switch.
209 * <!-- end-user-doc -->
210 * @param object the target of the switch.
211 * @return the result of interpreting the object as an instance of '<em>Custom Method</em>'.
212 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
213 * @generated
214 */
215 public T caseCustomMethod(CustomMethod object) {
216 return null;
217 }
218
219 /**
220 * Returns the result of interpreting the object as an instance of '<em>Crud Service</em>'.
221 * <!-- begin-user-doc -->
222 * This implementation returns null;
223 * returning a non-null result will terminate the switch.
224 * <!-- end-user-doc -->
225 * @param object the target of the switch.
226 * @return the result of interpreting the object as an instance of '<em>Crud Service</em>'.
227 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
228 * @generated
229 */
230 public T caseCrudService(CrudService object) {
231 return null;
232 }
233
234 /**
235 * Returns the result of interpreting the object as an instance of '<em>Special Method</em>'.
236 * <!-- begin-user-doc -->
237 * This implementation returns null;
238 * returning a non-null result will terminate the switch.
239 * <!-- end-user-doc -->
240 * @param object the target of the switch.
241 * @return the result of interpreting the object as an instance of '<em>Special Method</em>'.
242 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
243 * @generated
244 */
245 public T caseSpecialMethod(SpecialMethod object) {
246 return null;
247 }
248
249 /**
250 * Returns the result of interpreting the object as an instance of '<em>Service Method</em>'.
251 * <!-- begin-user-doc -->
252 * This implementation returns null;
253 * returning a non-null result will terminate the switch.
254 * <!-- end-user-doc -->
255 * @param object the target of the switch.
256 * @return the result of interpreting the object as an instance of '<em>Service Method</em>'.
257 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
258 * @generated
259 */
260 public T caseServiceMethod(ServiceMethod object) {
261 return null;
262 }
263
264 /**
265 * Returns the result of interpreting the object as an instance of '<em>Parameter</em>'.
266 * <!-- begin-user-doc -->
267 * This implementation returns null;
268 * returning a non-null result will terminate the switch.
269 * <!-- end-user-doc -->
270 * @param object the target of the switch.
271 * @return the result of interpreting the object as an instance of '<em>Parameter</em>'.
272 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
273 * @generated
274 */
275 public T caseParameter(Parameter object) {
276 return null;
277 }
278
279 /**
280 * Returns the result of interpreting the object as an instance of '<em>Association Method</em>'.
281 * <!-- begin-user-doc -->
282 * This implementation returns null;
283 * returning a non-null result will terminate the switch.
284 * <!-- end-user-doc -->
285 * @param object the target of the switch.
286 * @return the result of interpreting the object as an instance of '<em>Association Method</em>'.
287 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
288 * @generated
289 */
290 public T caseAssociationMethod(AssociationMethod object) {
291 return null;
292 }
293
294 /**
295 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
296 * <!-- begin-user-doc -->
297 * This implementation returns null;
298 * returning a non-null result will terminate the switch, but this is the last case anyway.
299 * <!-- end-user-doc -->
300 * @param object the target of the switch.
301 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
302 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
303 * @generated
304 */
305 public T defaultCase(EObject object) {
306 return null;
307 }
308
309 } //ServiceDslSwitch