| /** |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * 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 |
| * |
| * Based on ideas from Xtext, Xtend, Xcore |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - Initial implementation |
| * |
| */ |
| package org.eclipse.osbp.xtext.messagedsl.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.osbp.xtext.messagedsl.*; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model <b>Factory</b>. |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class MessageDSLFactoryImpl extends EFactoryImpl implements MessageDSLFactory { |
| /** |
| * Creates the default factory implementation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static MessageDSLFactory init() { |
| try { |
| MessageDSLFactory theMessageDSLFactory = (MessageDSLFactory)EPackage.Registry.INSTANCE.getEFactory(MessageDSLPackage.eNS_URI); |
| if (theMessageDSLFactory != null) { |
| return theMessageDSLFactory; |
| } |
| } |
| catch (Exception exception) { |
| EcorePlugin.INSTANCE.log(exception); |
| } |
| return new MessageDSLFactoryImpl(); |
| } |
| |
| /** |
| * Creates an instance of the factory. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public MessageDSLFactoryImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EObject create(EClass eClass) { |
| switch (eClass.getClassifierID()) { |
| case MessageDSLPackage.MESSAGE_MODEL: return createMessageModel(); |
| case MessageDSLPackage.MESSAGE_PACKAGE: return createMessagePackage(); |
| case MessageDSLPackage.MESSAGE_CATEGORY: return createMessageCategory(); |
| case MessageDSLPackage.MESSAGE_GROUP: return createMessageGroup(); |
| case MessageDSLPackage.MESSAGE_ITEM: return createMessageItem(); |
| case MessageDSLPackage.MESSAGE_PARAMETER: return createMessageParameter(); |
| case MessageDSLPackage.MESSAGE_DEFAULT_FORMAT: return createMessageDefaultFormat(); |
| 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 MessageDSLPackage.PARAMETER_TYPE_ENUM: |
| return createParameterTypeEnumFromString(eDataType, initialValue); |
| case MessageDSLPackage.AUTOMATIC_OUTPUT_ENUM: |
| return createAutomaticOutputEnumFromString(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 MessageDSLPackage.PARAMETER_TYPE_ENUM: |
| return convertParameterTypeEnumToString(eDataType, instanceValue); |
| case MessageDSLPackage.AUTOMATIC_OUTPUT_ENUM: |
| return convertAutomaticOutputEnumToString(eDataType, instanceValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public MessageModel createMessageModel() { |
| MessageModelImpl messageModel = new MessageModelImpl(); |
| return messageModel; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public MessagePackage createMessagePackage() { |
| MessagePackageImpl messagePackage = new MessagePackageImpl(); |
| return messagePackage; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public MessageCategory createMessageCategory() { |
| MessageCategoryImpl messageCategory = new MessageCategoryImpl(); |
| return messageCategory; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public MessageGroup createMessageGroup() { |
| MessageGroupImpl messageGroup = new MessageGroupImpl(); |
| return messageGroup; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public MessageItem createMessageItem() { |
| MessageItemImpl messageItem = new MessageItemImpl(); |
| return messageItem; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public MessageParameter createMessageParameter() { |
| MessageParameterImpl messageParameter = new MessageParameterImpl(); |
| return messageParameter; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public MessageDefaultFormat createMessageDefaultFormat() { |
| MessageDefaultFormatImpl messageDefaultFormat = new MessageDefaultFormatImpl(); |
| return messageDefaultFormat; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ParameterTypeEnum createParameterTypeEnumFromString(EDataType eDataType, String initialValue) { |
| ParameterTypeEnum result = ParameterTypeEnum.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 convertParameterTypeEnumToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public AutomaticOutputEnum createAutomaticOutputEnumFromString(EDataType eDataType, String initialValue) { |
| AutomaticOutputEnum result = AutomaticOutputEnum.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 convertAutomaticOutputEnumToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public MessageDSLPackage getMessageDSLPackage() { |
| return (MessageDSLPackage)getEPackage(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @deprecated |
| * @generated |
| */ |
| @Deprecated |
| public static MessageDSLPackage getPackage() { |
| return MessageDSLPackage.eINSTANCE; |
| } |
| |
| } //MessageDSLFactoryImpl |