/******************************************************************************* | |
* Copyright (c) 2006, 2010 Soyatec (http://www.soyatec.com) 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: | |
* Soyatec - initial API and implementation | |
*******************************************************************************/ | |
package org.eclipse.xwt.emf.test.books.impl; | |
import org.eclipse.emf.ecore.EClass; | |
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.xwt.emf.test.books.Book; | |
import org.eclipse.xwt.emf.test.books.BooksFactory; | |
import org.eclipse.xwt.emf.test.books.BooksPackage; | |
import org.eclipse.xwt.emf.test.books.Bookstore; | |
import org.eclipse.xwt.emf.test.books.Title; | |
/** | |
* <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!-- | |
* end-user-doc --> | |
* | |
* @generated | |
*/ | |
public class BooksFactoryImpl extends EFactoryImpl implements BooksFactory { | |
/** | |
* Creates the default factory implementation. <!-- begin-user-doc --> <!-- | |
* end-user-doc --> | |
* | |
* @generated | |
*/ | |
public static BooksFactory init() { | |
try { | |
BooksFactory theBooksFactory = (BooksFactory) EPackage.Registry.INSTANCE | |
.getEFactory("org.eclipse.xwt.emf/books.ecore"); | |
if (theBooksFactory != null) { | |
return theBooksFactory; | |
} | |
} catch (Exception exception) { | |
EcorePlugin.INSTANCE.log(exception); | |
} | |
return new BooksFactoryImpl(); | |
} | |
/** | |
* Creates an instance of the factory. <!-- begin-user-doc --> <!-- | |
* end-user-doc --> | |
* | |
* @generated | |
*/ | |
public BooksFactoryImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
@Override | |
public EObject create(EClass eClass) { | |
switch (eClass.getClassifierID()) { | |
case BooksPackage.BOOKSTORE: | |
return createBookstore(); | |
case BooksPackage.BOOK: | |
return createBook(); | |
case BooksPackage.TITLE: | |
return createTitle(); | |
default: | |
throw new IllegalArgumentException("The class '" + eClass.getName() | |
+ "' is not a valid classifier"); | |
} | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public Bookstore createBookstore() { | |
BookstoreImpl bookstore = new BookstoreImpl(); | |
return bookstore; | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public Book createBook() { | |
BookImpl book = new BookImpl(); | |
return book; | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public Title createTitle() { | |
TitleImpl title = new TitleImpl(); | |
return title; | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public BooksPackage getBooksPackage() { | |
return (BooksPackage) getEPackage(); | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @deprecated | |
* @generated | |
*/ | |
@Deprecated | |
public static BooksPackage getPackage() { | |
return BooksPackage.eINSTANCE; | |
} | |
} // BooksFactoryImpl |