/** | |
* <copyright> | |
* </copyright> | |
* | |
* $Id$ | |
*/ | |
package org.eclipse.stem.foodproduction.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.stem.foodproduction.*; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model <b>Factory</b>. | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public class FoodproductionFactoryImpl extends EFactoryImpl implements FoodproductionFactory { | |
/** | |
* Creates the default factory implementation. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public static FoodproductionFactory init() { | |
try { | |
FoodproductionFactory theFoodproductionFactory = (FoodproductionFactory)EPackage.Registry.INSTANCE.getEFactory("http:///org/eclipse/stem/foodproduction/foodproduction.ecore"); | |
if (theFoodproductionFactory != null) { | |
return theFoodproductionFactory; | |
} | |
} | |
catch (Exception exception) { | |
EcorePlugin.INSTANCE.log(exception); | |
} | |
return new FoodproductionFactoryImpl(); | |
} | |
/** | |
* Creates an instance of the factory. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public FoodproductionFactoryImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public EObject create(EClass eClass) { | |
switch (eClass.getClassifierID()) { | |
case FoodproductionPackage.FOOD_PRODUCER: return createFoodProducer(); | |
case FoodproductionPackage.SLAUGHTER_HOUSE: return createSlaughterHouse(); | |
case FoodproductionPackage.FOOD_CONSUMER: return createFoodConsumer(); | |
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 FoodproductionPackage.CONSUMPTION_TYPE: | |
return createConsumptionTypeFromString(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 FoodproductionPackage.CONSUMPTION_TYPE: | |
return convertConsumptionTypeToString(eDataType, instanceValue); | |
default: | |
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); | |
} | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public FoodProducer createFoodProducer() { | |
FoodProducerImpl foodProducer = new FoodProducerImpl(); | |
return foodProducer; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public SlaughterHouse createSlaughterHouse() { | |
SlaughterHouseImpl slaughterHouse = new SlaughterHouseImpl(); | |
return slaughterHouse; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public FoodConsumer createFoodConsumer() { | |
FoodConsumerImpl foodConsumer = new FoodConsumerImpl(); | |
return foodConsumer; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public ConsumptionType createConsumptionTypeFromString(EDataType eDataType, String initialValue) { | |
ConsumptionType result = ConsumptionType.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 convertConsumptionTypeToString(EDataType eDataType, Object instanceValue) { | |
return instanceValue == null ? null : instanceValue.toString(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public FoodproductionPackage getFoodproductionPackage() { | |
return (FoodproductionPackage)getEPackage(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @deprecated | |
* @generated | |
*/ | |
@Deprecated | |
public static FoodproductionPackage getPackage() { | |
return FoodproductionPackage.eINSTANCE; | |
} | |
} //FoodproductionFactoryImpl |