Skip to content

Content of file TestDataFactoryImpl.java

/**
 * Copyright (c) 2011-2018 EclipseSource Muenchen GmbH and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 * EclipseSource Muenchen GmbH - initial API and implementation
 */
package org.eclipse.emf.ecp.edit.internal.model.testData.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.emf.ecp.edit.internal.model.testData.TestData;
import org.eclipse.emf.ecp.edit.internal.model.testData.TestDataFactory;
import org.eclipse.emf.ecp.edit.internal.model.testData.TestDataPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * 
 * @generated
 */
public class TestDataFactoryImpl extends EFactoryImpl implements TestDataFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public static TestDataFactory init() {
		try {
			final TestDataFactory theTestDataFactory = (TestDataFactory) EPackage.Registry.INSTANCE
				.getEFactory(TestDataPackage.eNS_URI);
			if (theTestDataFactory != null) {
				return theTestDataFactory;
			}
		} catch (final Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new TestDataFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public TestDataFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
		case TestDataPackage.TEST_DATA:
			return createTestData();
		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 TestDataPackage.STRING_WITH_MAX_LENGTH8:
			return createStringWithMaxLength8FromString(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 TestDataPackage.STRING_WITH_MAX_LENGTH8:
			return convertStringWithMaxLength8ToString(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
	 */
	public TestData createTestData() {
final TestDataImpl testData = new TestDataImpl(); return testData; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public String createStringWithMaxLength8FromString(EDataType eDataType, String initialValue) { return (String) super.createFromString(eDataType, initialValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public String convertStringWithMaxLength8ToString(EDataType eDataType, Object instanceValue) { return super.convertToString(eDataType, instanceValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public TestDataPackage getTestDataPackage() { return (TestDataPackage) getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @deprecated * @generated */ @Deprecated public static TestDataPackage getPackage() { return TestDataPackage.eINSTANCE; } } // TestDataFactoryImpl