/****************************************************************************** * Copyright (c) 2012-2013, Linagora * * 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: * Linagora - initial API and implementation *******************************************************************************/ package com.ebmwebsourcing.petals.services.eip.eip.impl; import com.ebmwebsourcing.petals.services.eip.eip.*; 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 EipFactoryImpl extends EFactoryImpl implements EipFactory { /** * Creates the default factory implementation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static EipFactory init() { try { EipFactory theEipFactory = (EipFactory)EPackage.Registry.INSTANCE.getEFactory("http://petals.ow2.org/components/eip/version-2"); if (theEipFactory != null) { return theEipFactory; } } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new EipFactoryImpl(); } /** * Creates an instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EipFactoryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case EipPackage.EIP_PROVIDES: return createEipProvides(); 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 EipPackage.EIP_TYPE: return createEipTypeFromString(eDataType, initialValue); case EipPackage.WIRETAP_WAY: return createWiretapWayFromString(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 EipPackage.EIP_TYPE: return convertEipTypeToString(eDataType, instanceValue); case EipPackage.WIRETAP_WAY: return convertWiretapWayToString(eDataType, instanceValue); default: throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EipProvides createEipProvides() { EipProvidesImpl eipProvides = new EipProvidesImpl(); return eipProvides; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EipType createEipTypeFromString(EDataType eDataType, String initialValue) { EipType result = EipType.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 convertEipTypeToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public WiretapWay createWiretapWayFromString(EDataType eDataType, String initialValue) { WiretapWay result = WiretapWay.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 convertWiretapWayToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EipPackage getEipPackage() { return (EipPackage)getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @deprecated * @generated */ @Deprecated public static EipPackage getPackage() { return EipPackage.eINSTANCE; } } //EipFactoryImpl