/** * Copyright (c) 2001-2011 Mad Cow Entertainment and Corporation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: �bel Heged�s - initial API and implementation */ package madcow.magic.database.core.impl; import madcow.magic.database.core.*; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EDataType; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.impl.EFactoryImpl; import org.eclipse.emf.ecore.plugin.EcorePlugin; /** * <!-- begin-user-doc --> * An implementation of the model <b>Factory</b>. * <!-- end-user-doc --> * @generated */ public class DatabaseFactoryImpl extends EFactoryImpl implements DatabaseFactory { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final String copyright = "Copyright (c) 2001-2011 Mad Cow Entertainment and Corporation\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0 \r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html \r\n\r\nContributors: �bel Heged�s - initial API and implementation"; /** * Creates the default factory implementation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static DatabaseFactory init() { try { DatabaseFactory theDatabaseFactory = (DatabaseFactory)EPackage.Registry.INSTANCE.getEFactory("http://madcow.magic.database.core"); if (theDatabaseFactory != null) { return theDatabaseFactory; } } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new DatabaseFactoryImpl(); } /** * Creates an instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public DatabaseFactoryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case DatabasePackage.MAGIC_DB_ELEMENT: return createMagicDBElement(); case DatabasePackage.DATABASE: return createDatabase(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object createFromString(EDataType eDataType, String initialValue) { switch (eDataType.getClassifierID()) { case DatabasePackage.CARD_CSV_FIELDS: return createCardCSVFieldsFromString(eDataType, initialValue); default: throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String convertToString(EDataType eDataType, Object instanceValue) { switch (eDataType.getClassifierID()) { case DatabasePackage.CARD_CSV_FIELDS: return convertCardCSVFieldsToString(eDataType, instanceValue); default: throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MagicDBElement createMagicDBElement() { MagicDBElementImpl magicDBElement = new MagicDBElementImpl(); return magicDBElement; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Database createDatabase() { DatabaseImpl database = new DatabaseImpl(); return database; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public CardCSVFields createCardCSVFieldsFromString(EDataType eDataType, String initialValue) { CardCSVFields result = CardCSVFields.get(initialValue); if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); return result; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String convertCardCSVFieldsToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public DatabasePackage getDatabasePackage() { return (DatabasePackage)getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @deprecated * @generated */ @Deprecated public static DatabasePackage getPackage() { return DatabasePackage.eINSTANCE; } } //DatabaseFactoryImpl