/** * Copyright (c) 2008, 2009 Borland Software Corp. * * 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: * Alexander Shatalin (Borland) - initial API and implementation * * $Id$ */ package org.eclipse.gmf.tests.xpand.migration.testModel.impl; 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; import org.eclipse.gmf.tests.xpand.migration.testModel.*; /** * <!-- begin-user-doc --> * An implementation of the model <b>Factory</b>. * <!-- end-user-doc --> * @generated */ public class MigrationTestsFactoryImpl extends EFactoryImpl implements MigrationTestsFactory { /** * Creates the default factory implementation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static MigrationTestsFactory init() { try { MigrationTestsFactory theMigrationTestsFactory = (MigrationTestsFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/gmf/2008/org.eclipse.gmf.tests.xpand.migration/testModel"); if (theMigrationTestsFactory != null) { return theMigrationTestsFactory; } } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new MigrationTestsFactoryImpl(); } /** * Creates an instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MigrationTestsFactoryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case MigrationTestsPackage.CONTAINER: return createContainer(); case MigrationTestsPackage.CHILD: return createChild(); case MigrationTestsPackage.SUB_CONTAINER: return createSubContainer(); case MigrationTestsPackage.DEFAULT_ATTRIBUTE_CONTAINER: return createDefaultAttributeContainer(); 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 MigrationTestsPackage.ENUMERATION: return createEnumerationFromString(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 MigrationTestsPackage.ENUMERATION: return convertEnumerationToString(eDataType, instanceValue); default: throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public org.eclipse.gmf.tests.xpand.migration.testModel.Container createContainer() { ContainerImpl container = new ContainerImpl(); return container; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Child createChild() { ChildImpl child = new ChildImpl(); return child; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SubContainer createSubContainer() { SubContainerImpl subContainer = new SubContainerImpl(); return subContainer; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public DefaultAttributeContainer createDefaultAttributeContainer() { DefaultAttributeContainerImpl defaultAttributeContainer = new DefaultAttributeContainerImpl(); return defaultAttributeContainer; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Enumeration createEnumerationFromString(EDataType eDataType, String initialValue) { Enumeration result = Enumeration.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 convertEnumerationToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MigrationTestsPackage getMigrationTestsPackage() { return (MigrationTestsPackage)getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @deprecated * @generated */ @Deprecated public static MigrationTestsPackage getPackage() { return MigrationTestsPackage.eINSTANCE; } } //MigrationTestsFactoryImpl