/** * <copyright> * </copyright> * * $Id$ */ package orgomg.cwm.objectmodel.relationships.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 orgomg.cwm.objectmodel.relationships.*; /** * <!-- begin-user-doc --> * An implementation of the model <b>Factory</b>. * <!-- end-user-doc --> * @generated */ public class RelationshipsFactoryImpl extends EFactoryImpl implements RelationshipsFactory { /** * Creates the default factory implementation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static RelationshipsFactory init() { try { RelationshipsFactory theRelationshipsFactory = (RelationshipsFactory)EPackage.Registry.INSTANCE.getEFactory("http:///orgomg/cwm/objectmodel/relationships.ecore"); if (theRelationshipsFactory != null) { return theRelationshipsFactory; } } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new RelationshipsFactoryImpl(); } /** * Creates an instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public RelationshipsFactoryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case RelationshipsPackage.ASSOCIATION: return createAssociation(); case RelationshipsPackage.ASSOCIATION_END: return createAssociationEnd(); case RelationshipsPackage.GENERALIZATION: return createGeneralization(); 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 RelationshipsPackage.AGGREGATION_KIND: return createAggregationKindFromString(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 RelationshipsPackage.AGGREGATION_KIND: return convertAggregationKindToString(eDataType, instanceValue); default: throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Association createAssociation() { AssociationImpl association = new AssociationImpl(); return association; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AssociationEnd createAssociationEnd() { AssociationEndImpl associationEnd = new AssociationEndImpl(); return associationEnd; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Generalization createGeneralization() { GeneralizationImpl generalization = new GeneralizationImpl(); return generalization; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AggregationKind createAggregationKindFromString(EDataType eDataType, String initialValue) { AggregationKind result = AggregationKind.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 convertAggregationKindToString(EDataType eDataType, Object instanceValue) { return instanceValue == null ? null : instanceValue.toString(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public RelationshipsPackage getRelationshipsPackage() { return (RelationshipsPackage)getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @deprecated * @generated */ @Deprecated public static RelationshipsPackage getPackage() { return RelationshipsPackage.eINSTANCE; } } //RelationshipsFactoryImpl