| /** |
| * <copyright> |
| * |
| * Copyright (c) 2005, 2013 IBM Corporation and others. |
| * 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 |
| * |
| * Contributors: |
| * IBM - Initial API and implementation |
| * |
| * </copyright> |
| * |
| * $Id: EXTLibraryFactoryImpl.java,v 1.3 2006/12/29 18:27:44 marcelop Exp $ |
| */ |
| package org.eclipse.emf.parsley.examples.library.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.parsley.examples.library.*; |
| |
| |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model <b>Factory</b>. |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class EXTLibraryFactoryImpl extends EFactoryImpl implements EXTLibraryFactory |
| { |
| /** |
| * Creates the default factory implementation. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static EXTLibraryFactory init() |
| { |
| try { |
| EXTLibraryFactory theEXTLibraryFactory = (EXTLibraryFactory)EPackage.Registry.INSTANCE.getEFactory(EXTLibraryPackage.eNS_URI); |
| if (theEXTLibraryFactory != null) { |
| return theEXTLibraryFactory; |
| } |
| } |
| catch (Exception exception) { |
| EcorePlugin.INSTANCE.log(exception); |
| } |
| return new EXTLibraryFactoryImpl(); |
| } |
| |
| /** |
| * Creates an instance of the factory. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EXTLibraryFactoryImpl() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EObject create(EClass eClass) |
| { |
| switch (eClass.getClassifierID()) { |
| case EXTLibraryPackage.BOOK: return createBook(); |
| case EXTLibraryPackage.LIBRARY: return createLibrary(); |
| case EXTLibraryPackage.WRITER: return createWriter(); |
| case EXTLibraryPackage.BOOK_ON_TAPE: return createBookOnTape(); |
| case EXTLibraryPackage.VIDEO_CASSETTE: return createVideoCassette(); |
| case EXTLibraryPackage.BORROWER: return createBorrower(); |
| case EXTLibraryPackage.PERSON: return createPerson(); |
| case EXTLibraryPackage.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 EXTLibraryPackage.BOOK_CATEGORY: |
| return createBookCategoryFromString(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 EXTLibraryPackage.BOOK_CATEGORY: |
| return convertBookCategoryToString(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 Book createBook() |
| { |
| BookImpl book = new BookImpl(); |
| return book; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Library createLibrary() |
| { |
| LibraryImpl library = new LibraryImpl(); |
| return library; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Writer createWriter() |
| { |
| WriterImpl writer = new WriterImpl(); |
| return writer; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public BookOnTape createBookOnTape() |
| { |
| BookOnTapeImpl bookOnTape = new BookOnTapeImpl(); |
| return bookOnTape; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public VideoCassette createVideoCassette() |
| { |
| VideoCassetteImpl videoCassette = new VideoCassetteImpl(); |
| return videoCassette; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Borrower createBorrower() |
| { |
| BorrowerImpl borrower = new BorrowerImpl(); |
| return borrower; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Person createPerson() |
| { |
| PersonImpl person = new PersonImpl(); |
| return person; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Employee createEmployee() |
| { |
| EmployeeImpl employee = new EmployeeImpl(); |
| return employee; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public BookCategory createBookCategoryFromString(EDataType eDataType, String initialValue) |
| { |
| BookCategory result = BookCategory.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 convertBookCategoryToString(EDataType eDataType, Object instanceValue) |
| { |
| return instanceValue == null ? null : instanceValue.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EXTLibraryPackage getEXTLibraryPackage() |
| { |
| return (EXTLibraryPackage)getEPackage(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @deprecated |
| * @generated |
| */ |
| @Deprecated |
| public static EXTLibraryPackage getPackage() |
| { |
| return EXTLibraryPackage.eINSTANCE; |
| } |
| |
| } //EXTLibraryFactoryImpl |