/** | |
* Copyright (c) 2020 CEA LIST. | |
* | |
* 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\n\nContributors: | |
* Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr | |
* - Initial API and Implementation | |
*/ | |
package org.eclipse.efm.ecore.formalml.specification.impl; | |
import org.eclipse.efm.ecore.formalml.specification.*; | |
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 SpecificationFactoryImpl extends EFactoryImpl implements SpecificationFactory { | |
/** | |
* Creates the default factory implementation. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public static SpecificationFactory init() { | |
try { | |
SpecificationFactory theSpecificationFactory = (SpecificationFactory)EPackage.Registry.INSTANCE.getEFactory(SpecificationPackage.eNS_URI); | |
if (theSpecificationFactory != null) { | |
return theSpecificationFactory; | |
} | |
} | |
catch (Exception exception) { | |
EcorePlugin.INSTANCE.log(exception); | |
} | |
return new SpecificationFactoryImpl(); | |
} | |
/** | |
* Creates an instance of the factory. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public SpecificationFactoryImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public EObject create(EClass eClass) { | |
switch (eClass.getClassifierID()) { | |
case SpecificationPackage.XLIA_MODEL: return createXliaModel(); | |
case SpecificationPackage.XLIA_NAMED_ELEMENT: return createXliaNamedElement(); | |
case SpecificationPackage.XLIA_OBJECT: return createXliaObject(); | |
case SpecificationPackage.XLIA_SECTION: return createXliaSection(); | |
case SpecificationPackage.XLIA_ATTRIBUTE: return createXliaAttribute(); | |
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 SpecificationPackage.XLIA_MODEL_KIND: | |
return createXliaModelKindFromString(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 SpecificationPackage.XLIA_MODEL_KIND: | |
return convertXliaModelKindToString(eDataType, instanceValue); | |
default: | |
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); | |
} | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public XliaModel createXliaModel() { | |
XliaModelImpl xliaModel = new XliaModelImpl(); | |
return xliaModel; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public XliaNamedElement createXliaNamedElement() { | |
XliaNamedElementImpl xliaNamedElement = new XliaNamedElementImpl(); | |
return xliaNamedElement; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public XliaObject createXliaObject() { | |
XliaObjectImpl xliaObject = new XliaObjectImpl(); | |
return xliaObject; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public XliaSection createXliaSection() { | |
XliaSectionImpl xliaSection = new XliaSectionImpl(); | |
return xliaSection; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public XliaAttribute createXliaAttribute() { | |
XliaAttributeImpl xliaAttribute = new XliaAttributeImpl(); | |
return xliaAttribute; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public XliaModelKind createXliaModelKindFromString(EDataType eDataType, String initialValue) { | |
XliaModelKind result = XliaModelKind.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 convertXliaModelKindToString(EDataType eDataType, Object instanceValue) { | |
return instanceValue == null ? null : instanceValue.toString(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public SpecificationPackage getSpecificationPackage() { | |
return (SpecificationPackage)getEPackage(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @deprecated | |
* @generated | |
*/ | |
@Deprecated | |
public static SpecificationPackage getPackage() { | |
return SpecificationPackage.eINSTANCE; | |
} | |
} //SpecificationFactoryImpl |