KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > mapping > ecore2ecore > util > Ecore2EcoreAdapterFactory


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

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

41 public class Ecore2EcoreAdapterFactory extends AdapterFactoryImpl
42 {
43   /**
44    * The cached model package.
45    * <!-- begin-user-doc -->
46    * <!-- end-user-doc -->
47    * @generated
48    */

49   protected static Ecore2EcorePackage modelPackage;
50
51   /**
52    * Creates an instance of the adapter factory.
53    * <!-- begin-user-doc -->
54    * <!-- end-user-doc -->
55    * @generated
56    */

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

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

92   protected Ecore2EcoreSwitch modelSwitch =
93     new Ecore2EcoreSwitch()
94     {
95       public Object JavaDoc caseEcore2EcoreMappingRoot(Ecore2EcoreMappingRoot object)
96       {
97         return createEcore2EcoreMappingRootAdapter();
98       }
99       public Object JavaDoc caseMapping(Mapping object)
100       {
101         return createMappingAdapter();
102       }
103       public Object JavaDoc caseMappingRoot(MappingRoot object)
104       {
105         return createMappingRootAdapter();
106       }
107       public Object JavaDoc defaultCase(EObject object)
108       {
109         return createEObjectAdapter();
110       }
111     };
112
113   /**
114    * Creates an adapter for the <code>target</code>.
115    * <!-- begin-user-doc -->
116    * <!-- end-user-doc -->
117    * @param target the object to adapt.
118    * @return the adapter for the <code>target</code>.
119    * @generated
120    */

121   public Adapter createAdapter(Notifier target)
122   {
123     return (Adapter)modelSwitch.doSwitch((EObject)target);
124   }
125
126
127   /**
128    * Creates a new adapter for an object of class '{@link org.eclipse.emf.mapping.ecore2ecore.Ecore2EcoreMappingRoot <em>Mapping Root</em>}'.
129    * <!-- begin-user-doc -->
130    * This default implementation returns null so that we can easily ignore cases;
131    * it's useful to ignore a case when inheritance will catch all the cases anyway.
132    * <!-- end-user-doc -->
133    * @return the new adapter.
134    * @see org.eclipse.emf.mapping.ecore2ecore.Ecore2EcoreMappingRoot
135    * @generated
136    */

137   public Adapter createEcore2EcoreMappingRootAdapter()
138   {
139     return null;
140   }
141
142   /**
143    * Creates a new adapter for an object of class '{@link org.eclipse.emf.mapping.Mapping <em>Mapping</em>}'.
144    * <!-- begin-user-doc -->
145    * This default implementation returns null so that we can easily ignore cases;
146    * it's useful to ignore a case when inheritance will catch all the cases anyway.
147    * <!-- end-user-doc -->
148    * @return the new adapter.
149    * @see org.eclipse.emf.mapping.Mapping
150    * @generated
151    */

152   public Adapter createMappingAdapter()
153   {
154     return null;
155   }
156
157   /**
158    * Creates a new adapter for an object of class '{@link org.eclipse.emf.mapping.MappingRoot <em>Root</em>}'.
159    * <!-- begin-user-doc -->
160    * This default implementation returns null so that we can easily ignore cases;
161    * it's useful to ignore a case when inheritance will catch all the cases anyway.
162    * <!-- end-user-doc -->
163    * @return the new adapter.
164    * @see org.eclipse.emf.mapping.MappingRoot
165    * @generated
166    */

167   public Adapter createMappingRootAdapter()
168   {
169     return null;
170   }
171
172   /**
173    * Creates a new adapter for the default case.
174    * <!-- begin-user-doc -->
175    * This default implementation returns null.
176    * <!-- end-user-doc -->
177    * @return the new adapter.
178    * @generated
179    */

180   public Adapter createEObjectAdapter()
181   {
182     return null;
183   }
184
185 } //Ecore2EcoreAdapterFactory
186
Popular Tags