| /******************************************************************************* |
| * <copyright> |
| * |
| * Copyright (c) 2013, 2013 SAP AG. |
| * 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: |
| * SAP AG - initial API, implementation and documentation |
| * |
| * </copyright> |
| * |
| *******************************************************************************/ |
| package org.eclipse.fmc.mm.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.fmc.mm.*; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model <b>Factory</b>. |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class FmcFactoryImpl extends EFactoryImpl implements FmcFactory { |
| /** |
| * Creates the default factory implementation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static FmcFactory init() { |
| try { |
| FmcFactory theFmcFactory = (FmcFactory)EPackage.Registry.INSTANCE.getEFactory(FmcPackage.eNS_URI); |
| if (theFmcFactory != null) { |
| return theFmcFactory; |
| } |
| } |
| catch (Exception exception) { |
| EcorePlugin.INSTANCE.log(exception); |
| } |
| return new FmcFactoryImpl(); |
| } |
| |
| /** |
| * Creates an instance of the factory. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public FmcFactoryImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EObject create(EClass eClass) { |
| switch (eClass.getClassifierID()) { |
| case FmcPackage.AGENT: return createAgent(); |
| case FmcPackage.CHANNEL: return createChannel(); |
| case FmcPackage.STORAGE: return createStorage(); |
| case FmcPackage.ACCESS: return createAccess(); |
| case FmcPackage.FMC_MODEL: return createFMCModel(); |
| case FmcPackage.STRUCTURE_VARIANCE: return createStructureVariance(); |
| case FmcPackage.METADATA: return createMetadata(); |
| case FmcPackage.COMMENT: return createComment(); |
| case FmcPackage.STEREOTYPE: return createStereotype(); |
| case FmcPackage.STEREOTYPE_VALUE: return createStereotypeValue(); |
| 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 FmcPackage.ACCESS_TYPE: |
| return createAccessTypeFromString(eDataType, initialValue); |
| case FmcPackage.REQUEST_DIRECTION: |
| return createRequestDirectionFromString(eDataType, initialValue); |
| case FmcPackage.MULTIPLICITY_TYPE: |
| return createMultiplicityTypeFromString(eDataType, initialValue); |
| case FmcPackage.DATAFLOW_DIRECTION: |
| return createDataflowDirectionFromString(eDataType, initialValue); |
| case FmcPackage.COMMENT_TYPE: |
| return createCommentTypeFromString(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 FmcPackage.ACCESS_TYPE: |
| return convertAccessTypeToString(eDataType, instanceValue); |
| case FmcPackage.REQUEST_DIRECTION: |
| return convertRequestDirectionToString(eDataType, instanceValue); |
| case FmcPackage.MULTIPLICITY_TYPE: |
| return convertMultiplicityTypeToString(eDataType, instanceValue); |
| case FmcPackage.DATAFLOW_DIRECTION: |
| return convertDataflowDirectionToString(eDataType, instanceValue); |
| case FmcPackage.COMMENT_TYPE: |
| return convertCommentTypeToString(eDataType, instanceValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Agent createAgent() { |
| AgentImpl agent = new AgentImpl(); |
| return agent; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Channel createChannel() { |
| ChannelImpl channel = new ChannelImpl(); |
| return channel; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Storage createStorage() { |
| StorageImpl storage = new StorageImpl(); |
| return storage; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Access createAccess() { |
| AccessImpl access = new AccessImpl(); |
| return access; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public FMCModel createFMCModel() { |
| FMCModelImpl fmcModel = new FMCModelImpl(); |
| return fmcModel; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public StructureVariance createStructureVariance() { |
| StructureVarianceImpl structureVariance = new StructureVarianceImpl(); |
| return structureVariance; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Metadata createMetadata() { |
| MetadataImpl metadata = new MetadataImpl(); |
| return metadata; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Comment createComment() { |
| CommentImpl comment = new CommentImpl(); |
| return comment; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Stereotype createStereotype() { |
| StereotypeImpl stereotype = new StereotypeImpl(); |
| return stereotype; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public StereotypeValue createStereotypeValue() { |
| StereotypeValueImpl stereotypeValue = new StereotypeValueImpl(); |
| return stereotypeValue; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public AccessType createAccessTypeFromString(EDataType eDataType, String initialValue) { |
| AccessType result = AccessType.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 convertAccessTypeToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public RequestDirection createRequestDirectionFromString(EDataType eDataType, String initialValue) { |
| RequestDirection result = RequestDirection.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 convertRequestDirectionToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public MultiplicityType createMultiplicityTypeFromString(EDataType eDataType, String initialValue) { |
| MultiplicityType result = MultiplicityType.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 convertMultiplicityTypeToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public DataflowDirection createDataflowDirectionFromString(EDataType eDataType, String initialValue) { |
| DataflowDirection result = DataflowDirection.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 convertDataflowDirectionToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CommentType createCommentTypeFromString(EDataType eDataType, String initialValue) { |
| CommentType result = CommentType.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 convertCommentTypeToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public FmcPackage getFmcPackage() { |
| return (FmcPackage)getEPackage(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @deprecated |
| * @generated |
| */ |
| @Deprecated |
| public static FmcPackage getPackage() { |
| return FmcPackage.eINSTANCE; |
| } |
| |
| } //FmcFactoryImpl |