KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > change > impl > ChangeFactoryImpl


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2003-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: ChangeFactoryImpl.java,v 1.6 2005/06/08 06:16:16 nickb Exp $
16  */

17 package org.eclipse.emf.ecore.change.impl;
18
19
20 import java.util.Map JavaDoc;
21
22 import org.eclipse.emf.common.util.EList;
23 import org.eclipse.emf.ecore.EClass;
24 import org.eclipse.emf.ecore.EDataType;
25 import org.eclipse.emf.ecore.EObject;
26 import org.eclipse.emf.ecore.EStructuralFeature;
27 import org.eclipse.emf.ecore.change.*;
28 import org.eclipse.emf.ecore.impl.EFactoryImpl;
29 import org.eclipse.emf.ecore.resource.Resource;
30
31
32 /**
33  * <!-- begin-user-doc -->
34  * An implementation of the model <b>Factory</b>.
35  * <!-- end-user-doc -->
36  * @generated
37  */

38 public class ChangeFactoryImpl extends EFactoryImpl implements ChangeFactory
39 {
40   /**
41    * Creates an instance of the factory.
42    * <!-- begin-user-doc -->
43    * <!-- end-user-doc -->
44    * @generated
45    */

46   public ChangeFactoryImpl()
47   {
48     super();
49   }
50
51   /**
52    * <!-- begin-user-doc -->
53    * <!-- end-user-doc -->
54    * @generated
55    */

56   public EObject create(EClass eClass)
57   {
58     switch (eClass.getClassifierID())
59     {
60       case ChangePackage.CHANGE_DESCRIPTION: return createChangeDescription();
61       case ChangePackage.EOBJECT_TO_CHANGES_MAP_ENTRY: return (EObject)createEObjectToChangesMapEntry();
62       case ChangePackage.FEATURE_CHANGE: return createFeatureChange();
63       case ChangePackage.LIST_CHANGE: return createListChange();
64       case ChangePackage.RESOURCE_CHANGE: return createResourceChange();
65       case ChangePackage.FEATURE_MAP_ENTRY: return createFeatureMapEntry();
66       default:
67         throw new IllegalArgumentException JavaDoc("The class '" + eClass.getName() + "' is not a valid classifier");
68     }
69   }
70
71   /**
72    * <!-- begin-user-doc -->
73    * <!-- end-user-doc -->
74    * @generated
75    */

76   public Object JavaDoc createFromString(EDataType eDataType, String JavaDoc initialValue)
77   {
78     switch (eDataType.getClassifierID())
79     {
80       case ChangePackage.CHANGE_KIND:
81       {
82         ChangeKind result = ChangeKind.get(initialValue);
83         if (result == null) throw new IllegalArgumentException JavaDoc("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
84         return result;
85       }
86       default:
87         throw new IllegalArgumentException JavaDoc("The datatype '" + eDataType.getName() + "' is not a valid classifier");
88     }
89   }
90
91   /**
92    * <!-- begin-user-doc -->
93    * <!-- end-user-doc -->
94    * @generated
95    */

96   public String JavaDoc convertToString(EDataType eDataType, Object JavaDoc instanceValue)
97   {
98     switch (eDataType.getClassifierID())
99     {
100       case ChangePackage.CHANGE_KIND:
101         return instanceValue == null ? null : instanceValue.toString();
102       default:
103         throw new IllegalArgumentException JavaDoc("The datatype '" + eDataType.getName() + "' is not a valid classifier");
104     }
105   }
106
107   /**
108    * <!-- begin-user-doc -->
109    * <!-- end-user-doc -->
110    * @generated
111    */

112   public ChangeDescription createChangeDescription()
113   {
114     ChangeDescriptionImpl changeDescription = new ChangeDescriptionImpl();
115     return changeDescription;
116   }
117
118   /**
119    * <!-- begin-user-doc -->
120    * <!-- end-user-doc -->
121    * @generated
122    */

123   public Map.Entry JavaDoc createEObjectToChangesMapEntry()
124   {
125     EObjectToChangesMapEntryImpl eObjectToChangesMapEntry = new EObjectToChangesMapEntryImpl();
126     return eObjectToChangesMapEntry;
127   }
128
129   /**
130    * <!-- begin-user-doc -->
131    * <!-- end-user-doc -->
132    * @generated
133    */

134   public FeatureChange createFeatureChange()
135   {
136     FeatureChangeImpl featureChange = new FeatureChangeImpl();
137     return featureChange;
138   }
139
140   public FeatureChange createFeatureChange(EStructuralFeature feature, Object JavaDoc oldValue, boolean oldIsSet)
141   {
142     FeatureChangeImpl featureChange = new FeatureChangeImpl(feature, oldValue, oldIsSet);
143     return featureChange;
144   }
145
146   /**
147    * <!-- begin-user-doc -->
148    * <!-- end-user-doc -->
149    * @generated
150    */

151   public ListChange createListChange()
152   {
153     ListChangeImpl listChange = new ListChangeImpl();
154     return listChange;
155   }
156
157   /**
158    * <!-- begin-user-doc -->
159    * <!-- end-user-doc -->
160    * @generated
161    */

162   public ResourceChange createResourceChange()
163   {
164     ResourceChangeImpl resourceChange = new ResourceChangeImpl();
165     return resourceChange;
166   }
167
168   public ResourceChange createResourceChange(Resource resource, EList oldValue)
169   {
170     ResourceChangeImpl resourceChange = new ResourceChangeImpl(resource, oldValue);
171     return resourceChange;
172   }
173
174   /**
175    * <!-- begin-user-doc -->
176    * <!-- end-user-doc -->
177    * @generated
178    */

179   public FeatureMapEntry createFeatureMapEntry()
180   {
181     FeatureMapEntryImpl featureMapEntry = new FeatureMapEntryImpl();
182     return featureMapEntry;
183   }
184
185   public FeatureMapEntry createFeatureMapEntry(EStructuralFeature feature, Object JavaDoc value)
186   {
187     FeatureMapEntryImpl featureMapEntry = new FeatureMapEntryImpl(feature, value);
188     return featureMapEntry;
189   }
190
191   /**
192    * <!-- begin-user-doc -->
193    * <!-- end-user-doc -->
194    * @generated
195    */

196   public ChangePackage getChangePackage()
197   {
198     return (ChangePackage)getEPackage();
199   }
200
201   /**
202    * <!-- begin-user-doc -->
203    * <!-- end-user-doc -->
204    * @deprecated
205    * @generated
206    */

207   public static ChangePackage getPackage()
208   {
209     return ChangePackage.eINSTANCE;
210   }
211
212   public Map.Entry JavaDoc createEObjectToChangesMapEntry(EObject eObject)
213   {
214     EObjectToChangesMapEntryImpl eObjectToChangesMapEntry = new EObjectToChangesMapEntryImpl();
215     eObjectToChangesMapEntry.setKey(eObject);
216     return eObjectToChangesMapEntry;
217   }
218
219 } //ChangeFactoryImpl
220
Popular Tags