/** * Copyright (c) 2006, 2007 Borland Software Corporation. * 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: * Richard Gronback (Borland) - initial API and implementation * * $Id: MindmapFactoryImpl.java,v 1.1 2007/10/31 13:49:16 rgronback Exp $ */ package org.eclipse.gmf.examples.mindmap.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.gmf.examples.mindmap.Map; import org.eclipse.gmf.examples.mindmap.MindmapFactory; import org.eclipse.gmf.examples.mindmap.MindmapPackage; import org.eclipse.gmf.examples.mindmap.Priority; import org.eclipse.gmf.examples.mindmap.Relationship; import org.eclipse.gmf.examples.mindmap.RelationshipType; import org.eclipse.gmf.examples.mindmap.Resource; import org.eclipse.gmf.examples.mindmap.ThreadItem; import org.eclipse.gmf.examples.mindmap.Topic; /** * <!-- begin-user-doc --> * An implementation of the model <b>Factory</b>. * <!-- end-user-doc --> * @generated */ public class MindmapFactoryImpl extends EFactoryImpl implements MindmapFactory { /** * Creates the default factory implementation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static MindmapFactory init() { try { MindmapFactory theMindmapFactory = (MindmapFactory)EPackage.Registry.INSTANCE.getEFactory("mindmap"); if (theMindmapFactory != null) { return theMindmapFactory; } } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new MindmapFactoryImpl(); } /** * Creates an instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MindmapFactoryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case MindmapPackage.TOPIC: return createTopic(); case MindmapPackage.MAP: return createMap(); case MindmapPackage.RESOURCE: return createResource(); case MindmapPackage.RELATIONSHIP: return createRelationship(); case MindmapPackage.THREAD: return createThread(); case MindmapPackage.THREAD_ITEM: return createThreadItem(); 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 MindmapPackage.RELATIONSHIP_TYPE: return createRelationshipTypeFromString(eDataType, initialValue); case MindmapPackage.PRIORITY: return createPriorityFromString(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 MindmapPackage.RELATIONSHIP_TYPE: return convertRelationshipTypeToString(eDataType, instanceValue); case MindmapPackage.PRIORITY: return convertPriorityToString(eDataType, instanceValue); default: throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Topic createTopic() { TopicImpl topic = new TopicImpl(); return topic; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Map createMap() { MapImpl map = new MapImpl(); return map; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Resource createResource() { ResourceImpl resource = new ResourceImpl(); return resource; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Relationship createRelationship() { RelationshipImpl relationship = new RelationshipImpl(); return relationship; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public org.eclipse.gmf.examples.mindmap.Thread createThread() { ThreadImpl thread = new ThreadImpl(); return thread; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ThreadItem createThreadItem() { ThreadItemImpl threadItem = new ThreadItemImpl(); return threadItem; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public RelationshipType createRelationshipTypeFromString(EDataType eDataType, String initialValue) { RelationshipType result = RelationshipType.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 convertRelationshipTypeToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Priority createPriorityFromString(EDataType eDataType, String initialValue) { Priority result = Priority.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 convertPriorityToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MindmapPackage getMindmapPackage() { return (MindmapPackage)getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @deprecated * @generated */ @Deprecated public static MindmapPackage getPackage() { return MindmapPackage.eINSTANCE; } } //MindmapFactoryImpl