/** * CertWare Project * Copyright (c) 2010 National Aeronautics and Space Administration. All rights reserved. */ package net.certware.verification.checklist.impl; import net.certware.verification.checklist.Category; import net.certware.verification.checklist.Checklist; import net.certware.verification.checklist.ChecklistFactory; import net.certware.verification.checklist.ChecklistPackage; import net.certware.verification.checklist.Choices; import net.certware.verification.checklist.Item; 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 ChecklistFactoryImpl extends EFactoryImpl implements ChecklistFactory { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final String copyright = "Copyright (c) 2010 National Aeronautics and Space Administration"; //$NON-NLS-1$ /** * Creates the default factory implementation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static ChecklistFactory init() { try { ChecklistFactory theChecklistFactory = (ChecklistFactory)EPackage.Registry.INSTANCE.getEFactory(ChecklistPackage.eNS_URI); if (theChecklistFactory != null) { return theChecklistFactory; } } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new ChecklistFactoryImpl(); } /** * Creates an instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ChecklistFactoryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case ChecklistPackage.CATEGORY: return createCategory(); case ChecklistPackage.ITEM: return createItem(); case ChecklistPackage.CHECKLIST: return createChecklist(); 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 ChecklistPackage.CHOICES: return createChoicesFromString(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 ChecklistPackage.CHOICES: return convertChoicesToString(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 Category createCategory() { CategoryImpl category = new CategoryImpl(); return category; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Item createItem() { ItemImpl item = new ItemImpl(); return item; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Checklist createChecklist() { ChecklistImpl checklist = new ChecklistImpl(); return checklist; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Choices createChoicesFromString(EDataType eDataType, String initialValue) { Choices result = Choices.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 convertChoicesToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ChecklistPackage getChecklistPackage() { return (ChecklistPackage)getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @deprecated * @generated */ @Deprecated public static ChecklistPackage getPackage() { return ChecklistPackage.eINSTANCE; } } //ChecklistFactoryImpl