KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > util > EcoreAdapterFactory


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

17 package org.eclipse.emf.ecore.util;
18
19
20 import java.util.Map JavaDoc;
21
22 import org.eclipse.emf.common.notify.Adapter;
23 import org.eclipse.emf.common.notify.Notifier;
24 import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
25 import org.eclipse.emf.ecore.*;
26 import org.eclipse.emf.ecore.EObject;
27
28
29 /**
30  * <!-- begin-user-doc -->
31  * The <b>Adapter Factory</b> for the model.
32  * It provides an adapter <code>createXXX</code> method for each class of the model.
33  * <!-- end-user-doc -->
34  * @see org.eclipse.emf.ecore.EcorePackage
35  * @generated
36  */

37 public class EcoreAdapterFactory extends AdapterFactoryImpl
38 {
39   /**
40    * The cached model package.
41    * <!-- begin-user-doc -->
42    * <!-- end-user-doc -->
43    * @generated
44    */

45   protected static EcorePackage modelPackage;
46
47   /**
48    * Creates an instance of the adapter factory.
49    * <!-- begin-user-doc -->
50    * <!-- end-user-doc -->
51    * @generated
52    */

53   public EcoreAdapterFactory()
54   {
55     if (modelPackage == null)
56     {
57       modelPackage = EcorePackage.eINSTANCE;
58     }
59   }
60
61   /**
62    * Returns whether this factory is applicable for the type of the object.
63    * <!-- begin-user-doc -->
64    * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
65    * <!-- end-user-doc -->
66    * @return whether this factory is applicable for the type of the object.
67    * @generated
68    */

69   public boolean isFactoryForType(Object JavaDoc object)
70   {
71     if (object == modelPackage)
72     {
73       return true;
74     }
75     if (object instanceof EObject)
76     {
77       return ((EObject)object).eClass().getEPackage() == modelPackage;
78     }
79     return false;
80   }
81
82   /**
83    * The switch the delegates to the <code>createXXX</code> methods.
84    * <!-- begin-user-doc -->
85    * <!-- end-user-doc -->
86    * @generated
87    */

88   protected EcoreSwitch modelSwitch =
89     new EcoreSwitch()
90     {
91       public Object JavaDoc caseEAttribute(EAttribute object)
92       {
93         return createEAttributeAdapter();
94       }
95       public Object JavaDoc caseEAnnotation(EAnnotation object)
96       {
97         return createEAnnotationAdapter();
98       }
99       public Object JavaDoc caseEClass(EClass object)
100       {
101         return createEClassAdapter();
102       }
103       public Object JavaDoc caseEClassifier(EClassifier object)
104       {
105         return createEClassifierAdapter();
106       }
107       public Object JavaDoc caseEDataType(EDataType object)
108       {
109         return createEDataTypeAdapter();
110       }
111       public Object JavaDoc caseEEnum(EEnum object)
112       {
113         return createEEnumAdapter();
114       }
115       public Object JavaDoc caseEEnumLiteral(EEnumLiteral object)
116       {
117         return createEEnumLiteralAdapter();
118       }
119       public Object JavaDoc caseEFactory(EFactory object)
120       {
121         return createEFactoryAdapter();
122       }
123       public Object JavaDoc caseEModelElement(EModelElement object)
124       {
125         return createEModelElementAdapter();
126       }
127       public Object JavaDoc caseENamedElement(ENamedElement object)
128       {
129         return createENamedElementAdapter();
130       }
131       public Object JavaDoc caseEOperation(EOperation object)
132       {
133         return createEOperationAdapter();
134       }
135       public Object JavaDoc caseEPackage(EPackage object)
136       {
137         return createEPackageAdapter();
138       }
139       public Object JavaDoc caseEParameter(EParameter object)
140       {
141         return createEParameterAdapter();
142       }
143       public Object JavaDoc caseEReference(EReference object)
144       {
145         return createEReferenceAdapter();
146       }
147       public Object JavaDoc caseEStructuralFeature(EStructuralFeature object)
148       {
149         return createEStructuralFeatureAdapter();
150       }
151       public Object JavaDoc caseETypedElement(ETypedElement object)
152       {
153         return createETypedElementAdapter();
154       }
155       public Object JavaDoc caseEStringToStringMapEntry(Map.Entry JavaDoc object)
156       {
157         return createEStringToStringMapEntryAdapter();
158       }
159       public Object JavaDoc defaultCase(EObject object)
160       {
161         return createEObjectAdapter();
162       }
163     };
164
165   /**
166    * Creates an adapter for the <code>target</code>.
167    * <!-- begin-user-doc -->
168    * <!-- end-user-doc -->
169    * @param target the object to adapt.
170    * @return the adapter for the <code>target</code>.
171    * @generated
172    */

173   public Adapter createAdapter(Notifier target)
174   {
175     return (Adapter)modelSwitch.doSwitch((EObject)target);
176   }
177
178
179   /**
180    * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EModelElement <em>EModel Element</em>}'.
181    * <!-- begin-user-doc -->
182    * This default implementation returns null so that we can easily ignore cases;
183    * it's useful to ignore a case when inheritance will catch all the cases anyway.
184    * <!-- end-user-doc -->
185    * @return the new adapter.
186    * @see org.eclipse.emf.ecore.EModelElement
187    * @generated
188    */

189   public Adapter createEModelElementAdapter()
190   {
191     return null;
192   }
193
194   /**
195    * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EStructuralFeature <em>EStructural Feature</em>}'.
196    * <!-- begin-user-doc -->
197    * This default implementation returns null so that we can easily ignore cases;
198    * it's useful to ignore a case when inheritance will catch all the cases anyway.
199    * <!-- end-user-doc -->
200    * @return the new adapter.
201    * @see org.eclipse.emf.ecore.EStructuralFeature
202    * @generated
203    */

204   public Adapter createEStructuralFeatureAdapter()
205   {
206     return null;
207   }
208
209   /**
210    * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EAnnotation <em>EAnnotation</em>}'.
211    * <!-- begin-user-doc -->
212    * This default implementation returns null so that we can easily ignore cases;
213    * it's useful to ignore a case when inheritance will catch all the cases anyway.
214    * <!-- end-user-doc -->
215    * @return the new adapter.
216    * @see org.eclipse.emf.ecore.EAnnotation
217    * @generated
218    */

219   public Adapter createEAnnotationAdapter()
220   {
221     return null;
222   }
223
224   /**
225    * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EAttribute <em>EAttribute</em>}'.
226    * <!-- begin-user-doc -->
227    * This default implementation returns null so that we can easily ignore cases;
228    * it's useful to ignore a case when inheritance will catch all the cases anyway.
229    * <!-- end-user-doc -->
230    * @return the new adapter.
231    * @see org.eclipse.emf.ecore.EAttribute
232    * @generated
233    */

234   public Adapter createEAttributeAdapter()
235   {
236     return null;
237   }
238
239   /**
240    * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EClass <em>EClass</em>}'.
241    * <!-- begin-user-doc -->
242    * This default implementation returns null so that we can easily ignore cases;
243    * it's useful to ignore a case when inheritance will catch all the cases anyway.
244    * <!-- end-user-doc -->
245    * @return the new adapter.
246    * @see org.eclipse.emf.ecore.EClass
247    * @generated
248    */

249   public Adapter createEClassAdapter()
250   {
251     return null;
252   }
253
254   /**
255    * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EDataType <em>EData Type</em>}'.
256    * <!-- begin-user-doc -->
257    * This default implementation returns null so that we can easily ignore cases;
258    * it's useful to ignore a case when inheritance will catch all the cases anyway.
259    * <!-- end-user-doc -->
260    * @return the new adapter.
261    * @see org.eclipse.emf.ecore.EDataType
262    * @generated
263    */

264   public Adapter createEDataTypeAdapter()
265   {
266     return null;
267   }
268
269   /**
270    * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EClassifier <em>EClassifier</em>}'.
271    * <!-- begin-user-doc -->
272    * This default implementation returns null so that we can easily ignore cases;
273    * it's useful to ignore a case when inheritance will catch all the cases anyway.
274    * <!-- end-user-doc -->
275    * @return the new adapter.
276    * @see org.eclipse.emf.ecore.EClassifier
277    * @generated
278    */

279   public Adapter createEClassifierAdapter()
280   {
281     return null;
282   }
283
284   /**
285    * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.ENamedElement <em>ENamed Element</em>}'.
286    * <!-- begin-user-doc -->
287    * This default implementation returns null so that we can easily ignore cases;
288    * it's useful to ignore a case when inheritance will catch all the cases anyway.
289    * <!-- end-user-doc -->
290    * @return the new adapter.
291    * @see org.eclipse.emf.ecore.ENamedElement
292    * @generated
293    */

294   public Adapter createENamedElementAdapter()
295   {
296     return null;
297   }
298
299   /**
300    * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.ETypedElement <em>ETyped Element</em>}'.
301    * <!-- begin-user-doc -->
302    * This default implementation returns null so that we can easily ignore cases;
303    * it's useful to ignore a case when inheritance will catch all the cases anyway.
304    * <!-- end-user-doc -->
305    * @return the new adapter.
306    * @see org.eclipse.emf.ecore.ETypedElement
307    * @generated
308    */

309   public Adapter createETypedElementAdapter()
310   {
311     return null;
312   }
313
314   /**
315    * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EParameter <em>EParameter</em>}'.
316    * <!-- begin-user-doc -->
317    * This default implementation returns null so that we can easily ignore cases;
318    * it's useful to ignore a case when inheritance will catch all the cases anyway.
319    * <!-- end-user-doc -->
320    * @return the new adapter.
321    * @see org.eclipse.emf.ecore.EParameter
322    * @generated
323    */

324   public Adapter createEParameterAdapter()
325   {
326     return null;
327   }
328
329   /**
330    * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EOperation <em>EOperation</em>}'.
331    * <!-- begin-user-doc -->
332    * This default implementation returns null so that we can easily ignore cases;
333    * it's useful to ignore a case when inheritance will catch all the cases anyway.
334    * <!-- end-user-doc -->
335    * @return the new adapter.
336    * @see org.eclipse.emf.ecore.EOperation
337    * @generated
338    */

339   public Adapter createEOperationAdapter()
340   {
341     return null;
342   }
343
344   /**
345    * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EPackage <em>EPackage</em>}'.
346    * <!-- begin-user-doc -->
347    * This default implementation returns null so that we can easily ignore cases;
348    * it's useful to ignore a case when inheritance will catch all the cases anyway.
349    * <!-- end-user-doc -->
350    * @return the new adapter.
351    * @see org.eclipse.emf.ecore.EPackage
352    * @generated
353    */

354   public Adapter createEPackageAdapter()
355   {
356     return null;
357   }
358
359   /**
360    * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EFactory <em>EFactory</em>}'.
361    * <!-- begin-user-doc -->
362    * This default implementation returns null so that we can easily ignore cases;
363    * it's useful to ignore a case when inheritance will catch all the cases anyway.
364    * <!-- end-user-doc -->
365    * @return the new adapter.
366    * @see org.eclipse.emf.ecore.EFactory
367    * @generated
368    */

369   public Adapter createEFactoryAdapter()
370   {
371     return null;
372   }
373
374   /**
375    * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EEnumLiteral <em>EEnum Literal</em>}'.
376    * <!-- begin-user-doc -->
377    * This default implementation returns null so that we can easily ignore cases;
378    * it's useful to ignore a case when inheritance will catch all the cases anyway.
379    * <!-- end-user-doc -->
380    * @return the new adapter.
381    * @see org.eclipse.emf.ecore.EEnumLiteral
382    * @generated
383    */

384   public Adapter createEEnumLiteralAdapter()
385   {
386     return null;
387   }
388
389   /**
390    * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EEnum <em>EEnum</em>}'.
391    * <!-- begin-user-doc -->
392    * This default implementation returns null so that we can easily ignore cases;
393    * it's useful to ignore a case when inheritance will catch all the cases anyway.
394    * <!-- end-user-doc -->
395    * @return the new adapter.
396    * @see org.eclipse.emf.ecore.EEnum
397    * @generated
398    */

399   public Adapter createEEnumAdapter()
400   {
401     return null;
402   }
403
404   /**
405    * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EReference <em>EReference</em>}'.
406    * <!-- begin-user-doc -->
407    * This default implementation returns null so that we can easily ignore cases;
408    * it's useful to ignore a case when inheritance will catch all the cases anyway.
409    * <!-- end-user-doc -->
410    * @return the new adapter.
411    * @see org.eclipse.emf.ecore.EReference
412    * @generated
413    */

414   public Adapter createEReferenceAdapter()
415   {
416     return null;
417   }
418
419   /**
420    * Creates a new adapter for an object of class '{@link java.util.Map.Entry <em>EString To String Map Entry</em>}'.
421    * <!-- begin-user-doc -->
422    * This default implementation returns null so that we can easily ignore cases;
423    * it's useful to ignore a case when inheritance will catch all the cases anyway.
424    * <!-- end-user-doc -->
425    * @return the new adapter.
426    * @see java.util.Map.Entry
427    * @generated
428    */

429   public Adapter createEStringToStringMapEntryAdapter()
430   {
431     return null;
432   }
433
434   /**
435    * Creates a new adapter for the default case.
436    * <!-- begin-user-doc -->
437    * This default implementation returns null.
438    * <!-- end-user-doc -->
439    * @return the new adapter.
440    * @generated
441    */

442   public Adapter createEObjectAdapter()
443   {
444     return null;
445   }
446
447 } //EcoreAdapterFactory
448
Popular Tags