KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > xml > namespace > impl > XMLNamespaceFactoryImpl


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: XMLNamespaceFactoryImpl.java,v 1.5 2005/06/08 06:20:10 nickb Exp $
16  */

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

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

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

50   public EObject create(EClass eClass)
51   {
52     switch (eClass.getClassifierID())
53     {
54       case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT: return createXMLNamespaceDocumentRoot();
55       default:
56         throw new IllegalArgumentException JavaDoc("The class '" + eClass.getName() + "' is not a valid classifier");
57     }
58   }
59
60   /**
61    * <!-- begin-user-doc -->
62    * <!-- end-user-doc -->
63    * @generated
64    */

65   public Object JavaDoc createFromString(EDataType eDataType, String JavaDoc initialValue)
66   {
67     switch (eDataType.getClassifierID())
68     {
69       case XMLNamespacePackage.SPACE_TYPE:
70       {
71         SpaceType result = SpaceType.get(initialValue);
72         if (result == null) throw new IllegalArgumentException JavaDoc("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
73         return result;
74       }
75       case XMLNamespacePackage.SPACE_TYPE_OBJECT:
76         return createSpaceTypeObjectFromString(eDataType, initialValue);
77       default:
78         throw new IllegalArgumentException JavaDoc("The datatype '" + eDataType.getName() + "' is not a valid classifier");
79     }
80   }
81
82   /**
83    * <!-- begin-user-doc -->
84    * <!-- end-user-doc -->
85    * @generated
86    */

87   public String JavaDoc convertToString(EDataType eDataType, Object JavaDoc instanceValue)
88   {
89     switch (eDataType.getClassifierID())
90     {
91       case XMLNamespacePackage.SPACE_TYPE:
92         return instanceValue == null ? null : instanceValue.toString();
93       case XMLNamespacePackage.SPACE_TYPE_OBJECT:
94         return convertSpaceTypeObjectToString(eDataType, instanceValue);
95       default:
96         throw new IllegalArgumentException JavaDoc("The datatype '" + eDataType.getName() + "' is not a valid classifier");
97     }
98   }
99
100   /**
101    * <!-- begin-user-doc -->
102    * <!-- end-user-doc -->
103    * @generated
104    */

105   public XMLNamespaceDocumentRoot createXMLNamespaceDocumentRoot()
106   {
107     XMLNamespaceDocumentRootImpl xmlNamespaceDocumentRoot = new XMLNamespaceDocumentRootImpl();
108     return xmlNamespaceDocumentRoot;
109   }
110
111   /**
112    * <!-- begin-user-doc -->
113    * <!-- end-user-doc -->
114    * @generated
115    */

116   public SpaceType createSpaceTypeObjectFromString(EDataType eDataType, String JavaDoc initialValue)
117   {
118     return (SpaceType)XMLNamespaceFactory.eINSTANCE.createFromString(XMLNamespacePackage.eINSTANCE.getSpaceType(), initialValue);
119   }
120
121   /**
122    * <!-- begin-user-doc -->
123    * <!-- end-user-doc -->
124    * @generated
125    */

126   public String JavaDoc convertSpaceTypeObjectToString(EDataType eDataType, Object JavaDoc instanceValue)
127   {
128     return XMLNamespaceFactory.eINSTANCE.convertToString(XMLNamespacePackage.eINSTANCE.getSpaceType(), instanceValue);
129   }
130
131   /**
132    * <!-- begin-user-doc -->
133    * <!-- end-user-doc -->
134    * @generated
135    */

136   public XMLNamespacePackage getXMLNamespacePackage()
137   {
138     return (XMLNamespacePackage)getEPackage();
139   }
140
141   /**
142    * <!-- begin-user-doc -->
143    * <!-- end-user-doc -->
144    * @deprecated
145    * @generated
146    */

147   public static XMLNamespacePackage getPackage()
148   {
149     return XMLNamespacePackage.eINSTANCE;
150   }
151
152 } //XMLNamespaceFactoryImpl
153
Popular Tags