KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > codegen > ecore > genmodel > impl > GenModelFactoryImpl


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: GenModelFactoryImpl.java,v 1.5 2005/06/08 06:18:44 nickb Exp $
16  */

17 package org.eclipse.emf.codegen.ecore.genmodel.impl;
18
19
20 import org.eclipse.emf.codegen.ecore.genmodel.*;
21 import org.eclipse.emf.ecore.EClass;
22 import org.eclipse.emf.ecore.EDataType;
23 import org.eclipse.emf.ecore.EObject;
24 import org.eclipse.emf.ecore.impl.EFactoryImpl;
25
26
27 /**
28  * <!-- begin-user-doc -->
29  * An implementation of the model <b>Factory</b>.
30  * <!-- end-user-doc -->
31  * @generated
32  */

33 public class GenModelFactoryImpl extends EFactoryImpl implements GenModelFactory
34 {
35   /**
36    * Creates an instance of the factory.
37    * <!-- begin-user-doc -->
38    * <!-- end-user-doc -->
39    * @generated
40    */

41   public GenModelFactoryImpl()
42   {
43     super();
44   }
45
46   /**
47    * <!-- begin-user-doc -->
48    * <!-- end-user-doc -->
49    * @generated
50    */

51   public EObject create(EClass eClass)
52   {
53     switch (eClass.getClassifierID())
54     {
55       case GenModelPackage.GEN_MODEL: return createGenModel();
56       case GenModelPackage.GEN_PACKAGE: return createGenPackage();
57       case GenModelPackage.GEN_CLASS: return createGenClass();
58       case GenModelPackage.GEN_FEATURE: return createGenFeature();
59       case GenModelPackage.GEN_ENUM: return createGenEnum();
60       case GenModelPackage.GEN_ENUM_LITERAL: return createGenEnumLiteral();
61       case GenModelPackage.GEN_DATA_TYPE: return createGenDataType();
62       case GenModelPackage.GEN_OPERATION: return createGenOperation();
63       case GenModelPackage.GEN_PARAMETER: return createGenParameter();
64       default:
65         throw new IllegalArgumentException JavaDoc("The class '" + eClass.getName() + "' is not a valid classifier");
66     }
67   }
68
69   /**
70    * <!-- begin-user-doc -->
71    * <!-- end-user-doc -->
72    * @generated
73    */

74   public Object JavaDoc createFromString(EDataType eDataType, String JavaDoc initialValue)
75   {
76     switch (eDataType.getClassifierID())
77     {
78       case GenModelPackage.GEN_PROVIDER_KIND:
79       {
80         GenProviderKind result = GenProviderKind.get(initialValue);
81         if (result == null) throw new IllegalArgumentException JavaDoc("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
82         return result;
83       }
84       case GenModelPackage.GEN_PROPERTY_KIND:
85       {
86         GenPropertyKind result = GenPropertyKind.get(initialValue);
87         if (result == null) throw new IllegalArgumentException JavaDoc("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
88         return result;
89       }
90       case GenModelPackage.GEN_RESOURCE_KIND:
91       {
92         GenResourceKind result = GenResourceKind.get(initialValue);
93         if (result == null) throw new IllegalArgumentException JavaDoc("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
94         return result;
95       }
96       default:
97         throw new IllegalArgumentException JavaDoc("The datatype '" + eDataType.getName() + "' is not a valid classifier");
98     }
99   }
100
101   /**
102    * <!-- begin-user-doc -->
103    * <!-- end-user-doc -->
104    * @generated
105    */

106   public String JavaDoc convertToString(EDataType eDataType, Object JavaDoc instanceValue)
107   {
108     switch (eDataType.getClassifierID())
109     {
110       case GenModelPackage.GEN_PROVIDER_KIND:
111         return instanceValue == null ? null : instanceValue.toString();
112       case GenModelPackage.GEN_PROPERTY_KIND:
113         return instanceValue == null ? null : instanceValue.toString();
114       case GenModelPackage.GEN_RESOURCE_KIND:
115         return instanceValue == null ? null : instanceValue.toString();
116       default:
117         throw new IllegalArgumentException JavaDoc("The datatype '" + eDataType.getName() + "' is not a valid classifier");
118     }
119   }
120
121   /**
122    * <!-- begin-user-doc -->
123    * <!-- end-user-doc -->
124    * @generated
125    */

126   public GenModel createGenModel()
127   {
128     GenModelImpl genModel = new GenModelImpl();
129     return genModel;
130   }
131
132   /**
133    * <!-- begin-user-doc -->
134    * <!-- end-user-doc -->
135    * @generated
136    */

137   public GenPackage createGenPackage()
138   {
139     GenPackageImpl genPackage = new GenPackageImpl();
140     return genPackage;
141   }
142
143   /**
144    * <!-- begin-user-doc -->
145    * <!-- end-user-doc -->
146    * @generated
147    */

148   public GenClass createGenClass()
149   {
150     GenClassImpl genClass = new GenClassImpl();
151     return genClass;
152   }
153
154   /**
155    * <!-- begin-user-doc -->
156    * <!-- end-user-doc -->
157    * @generated
158    */

159   public GenFeature createGenFeature()
160   {
161     GenFeatureImpl genFeature = new GenFeatureImpl();
162     return genFeature;
163   }
164
165   /**
166    * <!-- begin-user-doc -->
167    * <!-- end-user-doc -->
168    * @generated
169    */

170   public GenEnum createGenEnum()
171   {
172     GenEnumImpl genEnum = new GenEnumImpl();
173     return genEnum;
174   }
175
176   /**
177    * <!-- begin-user-doc -->
178    * <!-- end-user-doc -->
179    * @generated
180    */

181   public GenEnumLiteral createGenEnumLiteral()
182   {
183     GenEnumLiteralImpl genEnumLiteral = new GenEnumLiteralImpl();
184     return genEnumLiteral;
185   }
186
187   /**
188    * <!-- begin-user-doc -->
189    * <!-- end-user-doc -->
190    * @generated
191    */

192   public GenDataType createGenDataType()
193   {
194     GenDataTypeImpl genDataType = new GenDataTypeImpl();
195     return genDataType;
196   }
197
198   /**
199    * <!-- begin-user-doc -->
200    * <!-- end-user-doc -->
201    * @generated
202    */

203   public GenOperation createGenOperation()
204   {
205     GenOperationImpl genOperation = new GenOperationImpl();
206     return genOperation;
207   }
208
209   /**
210    * <!-- begin-user-doc -->
211    * <!-- end-user-doc -->
212    * @generated
213    */

214   public GenParameter createGenParameter()
215   {
216     GenParameterImpl genParameter = new GenParameterImpl();
217     return genParameter;
218   }
219
220   /**
221    * <!-- begin-user-doc -->
222    * <!-- end-user-doc -->
223    * @generated
224    */

225   public GenModelPackage getGenModelPackage()
226   {
227     return (GenModelPackage)getEPackage();
228   }
229
230   /**
231    * <!-- begin-user-doc -->
232    * <!-- end-user-doc -->
233    * @deprecated
234    * @generated
235    */

236   public static GenModelPackage getPackage()
237   {
238     return GenModelPackage.eINSTANCE;
239   }
240
241 } //GenModelFactoryImpl
242
Popular Tags