/**
*/
package regression.test;
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 -->
* The <b>Factory</b> for the model.
* It provides a create method for each non-abstract class of the model.
* <!-- end-user-doc -->
* @see regression.test.TestPackage
* @generated
*/
public class TestFactory extends EFactoryImpl {
/**
* The singleton instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final TestFactory eINSTANCE = init();
/**
* Creates the default factory implementation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static TestFactory init() {
try {
TestFactory theTestFactory = (TestFactory)EPackage.Registry.INSTANCE.getEFactory(TestPackage.eNS_URI);
if (theTestFactory != null) {
return theTestFactory;
}
}
catch (Exception exception) {
EcorePlugin.INSTANCE.log(exception);
}
return new TestFactory();
}
/**
* Creates an instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TestFactory() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EObject create(EClass eClass) {
switch (eClass.getClassifierID()) {
case TestPackage.DOCUMENT_ROOT: return createDocumentRoot();
case TestPackage.ELEMENT: return createElement();
case TestPackage.OUTPUT_TYPE: return createOutputType();
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 TestPackage.ELEMENT_TYPE:
return createElementTypeFromString(eDataType, initialValue);
case TestPackage.GENERATOR_TYPE:
return createGeneratorTypeFromString(eDataType, initialValue);
case TestPackage.ELEMENT_TYPE_OBJECT:
return createElementTypeObjectFromString(eDataType, initialValue);
case TestPackage.GENERATOR_TYPE_OBJECT:
return createGeneratorTypeObjectFromString(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 TestPackage.ELEMENT_TYPE:
return convertElementTypeToString(eDataType, instanceValue);
case TestPackage.GENERATOR_TYPE:
return convertGeneratorTypeToString(eDataType, instanceValue);
case TestPackage.ELEMENT_TYPE_OBJECT:
return convertElementTypeObjectToString(eDataType, instanceValue);
case TestPackage.GENERATOR_TYPE_OBJECT:
return convertGeneratorTypeObjectToString(eDataType, instanceValue);
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DocumentRoot createDocumentRoot() {
DocumentRoot documentRoot = new DocumentRoot();
return documentRoot;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Element createElement() {
Element element = new Element();
return element;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public OutputType createOutputType() {
OutputType outputType = new OutputType();
return outputType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ElementType createElementTypeFromString(EDataType eDataType, String initialValue) {
ElementType result = ElementType.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 convertElementTypeToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public GeneratorType createGeneratorTypeFromString(EDataType eDataType, String initialValue) {
GeneratorType result = GeneratorType.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 convertGeneratorTypeToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ElementType createElementTypeObjectFromString(EDataType eDataType, String initialValue) {
return createElementTypeFromString(TestPackage.Literals.ELEMENT_TYPE, initialValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String convertElementTypeObjectToString(EDataType eDataType, Object instanceValue) {
return convertElementTypeToString(TestPackage.Literals.ELEMENT_TYPE, instanceValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public GeneratorType createGeneratorTypeObjectFromString(EDataType eDataType, String initialValue) {
return createGeneratorTypeFromString(TestPackage.Literals.GENERATOR_TYPE, initialValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String convertGeneratorTypeObjectToString(EDataType eDataType, Object instanceValue) {
return convertGeneratorTypeToString(TestPackage.Literals.GENERATOR_TYPE, instanceValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TestPackage getTestPackage() {
return (TestPackage)getEPackage();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @deprecated
* @generated
*/
@Deprecated
public static TestPackage getPackage() {
return TestPackage.eINSTANCE;
}
} //TestFactory