| /** |
| * <copyright> |
| *******************************************************************************/ |
| package org.eclipse.ocl.examples.xtext.tests.noreflectioncompany.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.jdt.annotation.NonNull; |
| import org.eclipse.ocl.examples.xtext.tests.noreflectioncompany.Company; |
| import org.eclipse.ocl.examples.xtext.tests.noreflectioncompany.CompanySizeKind; |
| import org.eclipse.ocl.examples.xtext.tests.noreflectioncompany.Employee; |
| import org.eclipse.ocl.examples.xtext.tests.noreflectioncompany.NoreflectioncompanyFactory; |
| import org.eclipse.ocl.examples.xtext.tests.noreflectioncompany.NoreflectioncompanyPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model <b>Factory</b>. |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class NoreflectioncompanyFactoryImpl extends EFactoryImpl implements NoreflectioncompanyFactory { |
| /** |
| * Creates the default factory implementation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static NoreflectioncompanyFactory init() { |
| try { |
| NoreflectioncompanyFactory theNoreflectioncompanyFactory = (NoreflectioncompanyFactory)EPackage.Registry.INSTANCE.getEFactory(NoreflectioncompanyPackage.eNS_URI); |
| if (theNoreflectioncompanyFactory != null) { |
| return theNoreflectioncompanyFactory; |
| } |
| } |
| catch (Exception exception) { |
| EcorePlugin.INSTANCE.log(exception); |
| } |
| return new NoreflectioncompanyFactoryImpl(); |
| } |
| |
| /** |
| * Creates an instance of the factory. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NoreflectioncompanyFactoryImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public @NonNull EObject create(EClass eClass) { |
| switch (eClass.getClassifierID()) { |
| case NoreflectioncompanyPackage.COMPANY: return createCompany(); |
| case NoreflectioncompanyPackage.EMPLOYEE: return createEmployee(); |
| default: |
| throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object createFromString(EDataType eDataType, String initialValue) { |
| switch (eDataType.getClassifierID()) { |
| case NoreflectioncompanyPackage.COMPANY_SIZE_KIND: |
| return createCompanySizeKindFromString(eDataType, initialValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String convertToString(EDataType eDataType, Object instanceValue) { |
| switch (eDataType.getClassifierID()) { |
| case NoreflectioncompanyPackage.COMPANY_SIZE_KIND: |
| return convertCompanySizeKindToString(eDataType, instanceValue); |
| default: |
| throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public @NonNull Company createCompany() { |
| CompanyImpl company = new CompanyImpl(); |
| return company; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public @NonNull Employee createEmployee() { |
| EmployeeImpl employee = new EmployeeImpl(); |
| return employee; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CompanySizeKind createCompanySizeKindFromString(EDataType eDataType, String initialValue) { |
| CompanySizeKind result = CompanySizeKind.get(initialValue); |
| if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| return result; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String convertCompanySizeKindToString(EDataType eDataType, Object instanceValue) { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NoreflectioncompanyPackage getNoreflectioncompanyPackage() { |
| return (NoreflectioncompanyPackage)getEPackage(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @deprecated |
| * @generated |
| */ |
| @Deprecated |
| public static NoreflectioncompanyPackage getPackage() { |
| return NoreflectioncompanyPackage.eINSTANCE; |
| } |
| |
| } //NoreflectioncompanyFactoryImpl |