/** * <copyright> </copyright> * * $Id$ */ package org.talend.cwm.constants.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.talend.cwm.constants.*; /** * <!-- begin-user-doc --> * An implementation of the model <b>Factory</b>. * <!-- end-user-doc --> * @generated */ public class ConstantsFactoryImpl extends EFactoryImpl implements ConstantsFactory { /** * Creates the default factory implementation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ConstantsFactory init() { try { ConstantsFactory theConstantsFactory = (ConstantsFactory) EPackage.Registry.INSTANCE .getEFactory("http://www.talend.org/cwm/constants/constants/2010"); if (theConstantsFactory != null) { return theConstantsFactory; } } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new ConstantsFactoryImpl(); } /** * Creates an instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ConstantsFactoryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { 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 ConstantsPackage.DEVELOPMENT_STATUS: return createDevelopmentStatusFromString(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 ConstantsPackage.DEVELOPMENT_STATUS: return convertDevelopmentStatusToString(eDataType, instanceValue); default: throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public DevelopmentStatus createDevelopmentStatusFromString(EDataType eDataType, String initialValue) { DevelopmentStatus result = DevelopmentStatus.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 convertDevelopmentStatusToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ConstantsPackage getConstantsPackage() { return (ConstantsPackage) getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @deprecated * @generated */ @Deprecated public static ConstantsPackage getPackage() { return ConstantsPackage.eINSTANCE; } } //ConstantsFactoryImpl