/** */ package no.resheim.elibrarium.library.impl; import no.resheim.elibrarium.library.*; 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; /** * <!-- begin-user-doc --> * An implementation of the model <b>Factory</b>. * <!-- end-user-doc --> * @generated */ public class LibraryFactoryImpl extends EFactoryImpl implements LibraryFactory { /** * Creates the default factory implementation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static LibraryFactory init() { try { LibraryFactory theLibraryFactory = (LibraryFactory)EPackage.Registry.INSTANCE.getEFactory(LibraryPackage.eNS_URI); if (theLibraryFactory != null) { return theLibraryFactory; } } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new LibraryFactoryImpl(); } /** * Creates an instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public LibraryFactoryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case LibraryPackage.LIBRARY: return (EObject)createLibrary(); case LibraryPackage.BOOK: return (EObject)createBook(); case LibraryPackage.BOOKMARK: return (EObject)createBookmark(); case LibraryPackage.TEXT_ANNOTATION: return (EObject)createTextAnnotation(); case LibraryPackage.METADATA: return (EObject)createMetadata(); 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 LibraryPackage.ANNOTATION_COLOR: return createAnnotationColorFromString(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 LibraryPackage.ANNOTATION_COLOR: return convertAnnotationColorToString(eDataType, instanceValue); default: throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Library createLibrary() { LibraryImpl library = new LibraryImpl(); return library; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Book createBook() { BookImpl book = new BookImpl(); return book; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Bookmark createBookmark() { BookmarkImpl bookmark = new BookmarkImpl(); return bookmark; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TextAnnotation createTextAnnotation() { TextAnnotationImpl textAnnotation = new TextAnnotationImpl(); return textAnnotation; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Metadata createMetadata() { MetadataImpl metadata = new MetadataImpl(); return metadata; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AnnotationColor createAnnotationColorFromString(EDataType eDataType, String initialValue) { AnnotationColor result = AnnotationColor.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 convertAnnotationColorToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public LibraryPackage getLibraryPackage() { return (LibraryPackage)getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @deprecated * @generated */ @Deprecated public static LibraryPackage getPackage() { return LibraryPackage.eINSTANCE; } } //LibraryFactoryImpl