/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.eclipse.papyrus.customization.properties.generation.fieldselection.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.papyrus.customization.properties.generation.fieldselection.*;
import org.eclipse.papyrus.customization.properties.generation.wizard.widget.TernaryButton.State;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Factory</b>.
* <!-- end-user-doc -->
* @generated
*/
public class FieldSelectionFactoryImpl extends EFactoryImpl implements FieldSelectionFactory {
/**
* Creates the default factory implementation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static FieldSelectionFactory init() {
try {
FieldSelectionFactory theFieldSelectionFactory = (FieldSelectionFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/papyrus/properties/fieldSelection");
if (theFieldSelectionFactory != null) {
return theFieldSelectionFactory;
}
}
catch (Exception exception) {
EcorePlugin.INSTANCE.log(exception);
}
return new FieldSelectionFactoryImpl();
}
/**
* Creates an instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FieldSelectionFactoryImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EObject create(EClass eClass) {
switch (eClass.getClassifierID()) {
case FieldSelectionPackage.FIELD_SELECTION: return createFieldSelection();
case FieldSelectionPackage.PROPERTY_DEFINITION: return createPropertyDefinition();
case FieldSelectionPackage.CONTEXT_ELEMENT: return createContextElement();
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 FieldSelectionPackage.VALUE:
return createValueFromString(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 FieldSelectionPackage.VALUE:
return convertValueToString(eDataType, instanceValue);
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FieldSelection createFieldSelection() {
FieldSelectionImpl fieldSelection = new FieldSelectionImpl();
return fieldSelection;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PropertyDefinition createPropertyDefinition() {
PropertyDefinitionImpl propertyDefinition = new PropertyDefinitionImpl();
return propertyDefinition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ContextElement createContextElement() {
ContextElementImpl contextElement = new ContextElementImpl();
return contextElement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public State createValueFromString(EDataType eDataType, String initialValue) {
return (State)super.createFromString(eDataType, initialValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String convertValueToString(EDataType eDataType, Object instanceValue) {
return super.convertToString(eDataType, instanceValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FieldSelectionPackage getFieldSelectionPackage() {
return (FieldSelectionPackage)getEPackage();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @deprecated
* @generated
*/
@Deprecated
public static FieldSelectionPackage getPackage() {
return FieldSelectionPackage.eINSTANCE;
}
} //FieldSelectionFactoryImpl