1 7 package org.enhydra.dods.editor.Doml.impl; 8 9 import org.eclipse.emf.ecore.EClass; 10 import org.eclipse.emf.ecore.EDataType; 11 import org.eclipse.emf.ecore.EObject; 12 13 import org.eclipse.emf.ecore.impl.EFactoryImpl; 14 15 import org.enhydra.dods.editor.Doml.*; 16 17 23 public class DomlFactoryImpl extends EFactoryImpl implements DomlFactory { 24 30 public DomlFactoryImpl() { 31 super(); 32 } 33 34 39 public EObject create(EClass eClass) { 40 switch (eClass.getClassifierID()) { 41 case DomlPackage.COLUMN_TYPE: return createColumnType(); 42 case DomlPackage.DATABASE_TYPE: return createDatabaseType(); 43 case DomlPackage.DOCUMENT_ROOT: return createDocumentRoot(); 44 case DomlPackage.DOML_TYPE: return createDomlType(); 45 case DomlPackage.INDEX_COLUMN_TYPE: return createIndexColumnType(); 46 case DomlPackage.INDEX_TYPE: return createIndexType(); 47 case DomlPackage.PACKAGE_TYPE: return createPackageType(); 48 case DomlPackage.REFERENCE_OBJECT_TYPE: return createReferenceObjectType(); 49 case DomlPackage.TABLE_TYPE: return createTableType(); 50 case DomlPackage.TYPE_TYPE: return createTypeType(); 51 default: 52 throw new IllegalArgumentException ("The class '" + eClass.getName() + "' is not a valid classifier"); 53 } 54 } 55 56 61 public Object createFromString(EDataType eDataType, String initialValue) { 62 switch (eDataType.getClassifierID()) { 63 case DomlPackage.DB_VENDOR: { 64 DbVendor result = DbVendor.get(initialValue); 65 if (result == null) throw new IllegalArgumentException ("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); 66 return result; 67 } 68 case DomlPackage.DIRTY_DO: { 69 DirtyDO result = DirtyDO.get(initialValue); 70 if (result == null) throw new IllegalArgumentException ("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); 71 return result; 72 } 73 case DomlPackage.JDBC_TYPE: { 74 JdbcType result = JdbcType.get(initialValue); 75 if (result == null) throw new IllegalArgumentException ("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); 76 return result; 77 } 78 case DomlPackage.TRUE_FALSE: { 79 TrueFalse result = TrueFalse.get(initialValue); 80 if (result == null) throw new IllegalArgumentException ("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); 81 return result; 82 } 83 case DomlPackage.DB_VENDOR_OBJECT: 84 return createDbVendorObjectFromString(eDataType, initialValue); 85 case DomlPackage.DIRTY_DO_OBJECT: 86 return createDirtyDOObjectFromString(eDataType, initialValue); 87 case DomlPackage.JDBC_TYPE_OBJECT: 88 return createJdbcTypeObjectFromString(eDataType, initialValue); 89 case DomlPackage.TRUE_FALSE_OBJECT: 90 return createTrueFalseObjectFromString(eDataType, initialValue); 91 default: 92 throw new IllegalArgumentException ("The datatype '" + eDataType.getName() + "' is not a valid classifier"); 93 } 94 } 95 96 101 public String convertToString(EDataType eDataType, Object instanceValue) { 102 switch (eDataType.getClassifierID()) { 103 case DomlPackage.DB_VENDOR: 104 return instanceValue == null ? null : instanceValue.toString(); 105 case DomlPackage.DIRTY_DO: 106 return instanceValue == null ? null : instanceValue.toString(); 107 case DomlPackage.JDBC_TYPE: 108 return instanceValue == null ? null : instanceValue.toString(); 109 case DomlPackage.TRUE_FALSE: 110 return instanceValue == null ? null : instanceValue.toString(); 111 case DomlPackage.DB_VENDOR_OBJECT: 112 return convertDbVendorObjectToString(eDataType, instanceValue); 113 case DomlPackage.DIRTY_DO_OBJECT: 114 return convertDirtyDOObjectToString(eDataType, instanceValue); 115 case DomlPackage.JDBC_TYPE_OBJECT: 116 return convertJdbcTypeObjectToString(eDataType, instanceValue); 117 case DomlPackage.TRUE_FALSE_OBJECT: 118 return convertTrueFalseObjectToString(eDataType, instanceValue); 119 default: 120 throw new IllegalArgumentException ("The datatype '" + eDataType.getName() + "' is not a valid classifier"); 121 } 122 } 123 124 129 public ColumnType createColumnType() { 130 ColumnTypeImpl columnType = new ColumnTypeImpl(); 131 return columnType; 132 } 133 134 139 public DatabaseType createDatabaseType() { 140 DatabaseTypeImpl databaseType = new DatabaseTypeImpl(); 141 return databaseType; 142 } 143 144 149 public DocumentRoot createDocumentRoot() { 150 DocumentRootImpl documentRoot = new DocumentRootImpl(); 151 return documentRoot; 152 } 153 154 159 public DomlType createDomlType() { 160 DomlTypeImpl domlType = new DomlTypeImpl(); 161 return domlType; 162 } 163 164 169 public IndexColumnType createIndexColumnType() { 170 IndexColumnTypeImpl indexColumnType = new IndexColumnTypeImpl(); 171 return indexColumnType; 172 } 173 174 179 public IndexType createIndexType() { 180 IndexTypeImpl indexType = new IndexTypeImpl(); 181 return indexType; 182 } 183 184 189 public PackageType createPackageType() { 190 PackageTypeImpl packageType = new PackageTypeImpl(); 191 return packageType; 192 } 193 194 199 public ReferenceObjectType createReferenceObjectType() { 200 ReferenceObjectTypeImpl referenceObjectType = new ReferenceObjectTypeImpl(); 201 return referenceObjectType; 202 } 203 204 209 public TableType createTableType() { 210 TableTypeImpl tableType = new TableTypeImpl(); 211 return tableType; 212 } 213 214 219 public TypeType createTypeType() { 220 TypeTypeImpl typeType = new TypeTypeImpl(); 221 return typeType; 222 } 223 224 229 public DbVendor createDbVendorObjectFromString(EDataType eDataType, String initialValue) { 230 return (DbVendor)DomlFactory.eINSTANCE.createFromString(DomlPackage.eINSTANCE.getDbVendor(), initialValue); 231 } 232 233 238 public String convertDbVendorObjectToString(EDataType eDataType, Object instanceValue) { 239 return DomlFactory.eINSTANCE.convertToString(DomlPackage.eINSTANCE.getDbVendor(), instanceValue); 240 } 241 242 247 public DirtyDO createDirtyDOObjectFromString(EDataType eDataType, String initialValue) { 248 return (DirtyDO)DomlFactory.eINSTANCE.createFromString(DomlPackage.eINSTANCE.getDirtyDO(), initialValue); 249 } 250 251 256 public String convertDirtyDOObjectToString(EDataType eDataType, Object instanceValue) { 257 return DomlFactory.eINSTANCE.convertToString(DomlPackage.eINSTANCE.getDirtyDO(), instanceValue); 258 } 259 260 265 public JdbcType createJdbcTypeObjectFromString(EDataType eDataType, String initialValue) { 266 return (JdbcType)DomlFactory.eINSTANCE.createFromString(DomlPackage.eINSTANCE.getJdbcType(), initialValue); 267 } 268 269 274 public String convertJdbcTypeObjectToString(EDataType eDataType, Object instanceValue) { 275 return DomlFactory.eINSTANCE.convertToString(DomlPackage.eINSTANCE.getJdbcType(), instanceValue); 276 } 277 278 283 public TrueFalse createTrueFalseObjectFromString(EDataType eDataType, String initialValue) { 284 return (TrueFalse)DomlFactory.eINSTANCE.createFromString(DomlPackage.eINSTANCE.getTrueFalse(), initialValue); 285 } 286 287 292 public String convertTrueFalseObjectToString(EDataType eDataType, Object instanceValue) { 293 return DomlFactory.eINSTANCE.convertToString(DomlPackage.eINSTANCE.getTrueFalse(), instanceValue); 294 } 295 296 301 public DomlPackage getDomlPackage() { 302 return (DomlPackage)getEPackage(); 303 } 304 305 311 public static DomlPackage getPackage() { 312 return DomlPackage.eINSTANCE; 313 } 314 315 } | Popular Tags |