| /******************************************************************************* |
| * Copyright (c) 2007, 2010 BMW Car IT, Technische Universitaet Muenchen, and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * BMW Car IT - Initial API and implementation |
| * Technische Universitaet Muenchen - Major refactoring and extension |
| *******************************************************************************/ |
| package org.eclipse.emf.edapt.spi.migration.impl; |
| |
| import org.eclipse.emf.common.util.DiagnosticChain; |
| import org.eclipse.emf.common.util.URI; |
| 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.emf.edapt.internal.migration.DiagnosticException; |
| import org.eclipse.emf.edapt.spi.migration.AttributeSlot; |
| import org.eclipse.emf.edapt.spi.migration.Instance; |
| import org.eclipse.emf.edapt.spi.migration.Metamodel; |
| import org.eclipse.emf.edapt.spi.migration.MetamodelResource; |
| import org.eclipse.emf.edapt.spi.migration.MigrationFactory; |
| import org.eclipse.emf.edapt.spi.migration.MigrationPackage; |
| import org.eclipse.emf.edapt.spi.migration.Model; |
| import org.eclipse.emf.edapt.spi.migration.ModelResource; |
| import org.eclipse.emf.edapt.spi.migration.ReferenceSlot; |
| import org.eclipse.emf.edapt.spi.migration.Repository; |
| import org.eclipse.emf.edapt.spi.migration.Type; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model <b>Factory</b>. |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public class MigrationFactoryImpl extends EFactoryImpl implements MigrationFactory { |
| /** |
| * Creates the default factory implementation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public static MigrationFactory init() { |
| try { |
| final MigrationFactory theMigrationFactory = (MigrationFactory) EPackage.Registry.INSTANCE |
| .getEFactory("http://www.eclipse.org/emf/edapt/migration/0.3"); //$NON-NLS-1$ |
| if (theMigrationFactory != null) { |
| return theMigrationFactory; |
| } |
| } catch (final Exception exception) { |
| EcorePlugin.INSTANCE.log(exception); |
| } |
| return new MigrationFactoryImpl(); |
| } |
| |
| /** |
| * Creates an instance of the factory. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public MigrationFactoryImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EObject create(EClass eClass) { |
| switch (eClass.getClassifierID()) { |
| case MigrationPackage.REPOSITORY: |
| return (EObject) createRepository(); |
| case MigrationPackage.MODEL: |
| return (EObject) createModel(); |
| case MigrationPackage.MODEL_RESOURCE: |
| return (EObject) createModelResource(); |
| case MigrationPackage.TYPE: |
| return (EObject) createType(); |
| case MigrationPackage.INSTANCE: |
| return (EObject) createInstance(); |
| case MigrationPackage.ATTRIBUTE_SLOT: |
| return (EObject) createAttributeSlot(); |
| case MigrationPackage.REFERENCE_SLOT: |
| return (EObject) createReferenceSlot(); |
| case MigrationPackage.METAMODEL: |
| return (EObject) createMetamodel(); |
| case MigrationPackage.METAMODEL_RESOURCE: |
| return (EObject) createMetamodelResource(); |
| default: |
| throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Object createFromString(EDataType eDataType, String initialValue) { |
| switch (eDataType.getClassifierID()) { |
| case MigrationPackage.DIAGNOSTIC_CHAIN: |
| return createDiagnosticChainFromString(eDataType, initialValue); |
| case MigrationPackage.URI: |
| return createURIFromString(eDataType, initialValue); |
| case MigrationPackage.DIAGNOSTIC_EXCEPTION: |
| return createDiagnosticExceptionFromString(eDataType, initialValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public String convertToString(EDataType eDataType, Object instanceValue) { |
| switch (eDataType.getClassifierID()) { |
| case MigrationPackage.DIAGNOSTIC_CHAIN: |
| return convertDiagnosticChainToString(eDataType, instanceValue); |
| case MigrationPackage.URI: |
| return convertURIToString(eDataType, instanceValue); |
| case MigrationPackage.DIAGNOSTIC_EXCEPTION: |
| return convertDiagnosticExceptionToString(eDataType, instanceValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Model createModel() { |
| final ModelImpl model = new ModelImpl(); |
| return model; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Metamodel createMetamodel() { |
| final MetamodelImpl metamodel = new MetamodelImpl(); |
| return metamodel; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Type createType() { |
| final TypeImpl type = new TypeImpl(); |
| return type; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Instance createInstance() { |
| final InstanceImpl instance = new InstanceImpl(); |
| return instance; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public AttributeSlot createAttributeSlot() { |
| final AttributeSlotImpl attributeSlot = new AttributeSlotImpl(); |
| return attributeSlot; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public ReferenceSlot createReferenceSlot() { |
| final ReferenceSlotImpl referenceSlot = new ReferenceSlotImpl(); |
| return referenceSlot; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Repository createRepository() { |
| final RepositoryImpl repository = new RepositoryImpl(); |
| return repository; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public ModelResource createModelResource() { |
| final ModelResourceImpl modelResource = new ModelResourceImpl(); |
| return modelResource; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public MetamodelResource createMetamodelResource() { |
| final MetamodelResourceImpl metamodelResource = new MetamodelResourceImpl(); |
| return metamodelResource; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public DiagnosticChain createDiagnosticChainFromString(EDataType eDataType, String initialValue) { |
| return (DiagnosticChain) super.createFromString(eDataType, initialValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public String convertDiagnosticChainToString(EDataType eDataType, Object instanceValue) { |
| return super.convertToString(eDataType, instanceValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public URI createURIFromString(EDataType eDataType, String initialValue) { |
| return (URI) super.createFromString(eDataType, initialValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public String convertURIToString(EDataType eDataType, Object instanceValue) { |
| return super.convertToString(eDataType, instanceValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public DiagnosticException createDiagnosticExceptionFromString(EDataType eDataType, String initialValue) { |
| return (DiagnosticException) super.createFromString(eDataType, initialValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public String convertDiagnosticExceptionToString(EDataType eDataType, Object instanceValue) { |
| return super.convertToString(eDataType, instanceValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public MigrationPackage getMigrationPackage() { |
| return (MigrationPackage) getEPackage(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @deprecated |
| * @generated |
| */ |
| @Deprecated |
| public static MigrationPackage getPackage() { |
| return MigrationPackage.eINSTANCE; |
| } |
| |
| } // MigrationFactoryImpl |