org.nasdanika.models.source.impl.SourceFactoryImpl Maven / Gradle / Ivy
The newest version!
/**
*/
package org.nasdanika.models.source.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.nasdanika.models.source.GenerationMode;
import org.nasdanika.models.source.Position;
import org.nasdanika.models.source.Range;
import org.nasdanika.models.source.Source;
import org.nasdanika.models.source.SourceFactory;
import org.nasdanika.models.source.SourcePackage;
/**
*
* An implementation of the model Factory.
*
* @generated
*/
public class SourceFactoryImpl extends EFactoryImpl implements SourceFactory {
/**
* Creates the default factory implementation.
*
*
* @generated
*/
public static SourceFactory init() {
try {
SourceFactory theSourceFactory = (SourceFactory)EPackage.Registry.INSTANCE.getEFactory(SourcePackage.eNS_URI);
if (theSourceFactory != null) {
return theSourceFactory;
}
}
catch (Exception exception) {
EcorePlugin.INSTANCE.log(exception);
}
return new SourceFactoryImpl();
}
/**
* Creates an instance of the factory.
*
*
* @generated
*/
public SourceFactoryImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
public EObject create(EClass eClass) {
switch (eClass.getClassifierID()) {
case SourcePackage.POSITION: return createPosition();
case SourcePackage.RANGE: return createRange();
case SourcePackage.SOURCE: return createSource();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
}
/**
*
*
* @generated
*/
@Override
public Object createFromString(EDataType eDataType, String initialValue) {
switch (eDataType.getClassifierID()) {
case SourcePackage.GENERATION_MODE:
return createGenerationModeFromString(eDataType, initialValue);
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
}
}
/**
*
*
* @generated
*/
@Override
public String convertToString(EDataType eDataType, Object instanceValue) {
switch (eDataType.getClassifierID()) {
case SourcePackage.GENERATION_MODE:
return convertGenerationModeToString(eDataType, instanceValue);
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
}
}
/**
*
*
* @generated
*/
@Override
public Position createPosition() {
PositionImpl position = new PositionImpl();
return position;
}
/**
*
*
* @generated
*/
@Override
public Range createRange() {
RangeImpl range = new RangeImpl();
return range;
}
/**
*
*
* @generated
*/
@Override
public Source createSource() {
SourceImpl source = new SourceImpl();
return source;
}
/**
*
*
* @generated
*/
public GenerationMode createGenerationModeFromString(EDataType eDataType, String initialValue) {
GenerationMode result = GenerationMode.get(initialValue);
if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
}
/**
*
*
* @generated
*/
public String convertGenerationModeToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
*
*
* @generated
*/
@Override
public SourcePackage getSourcePackage() {
return (SourcePackage)getEPackage();
}
/**
*
*
* @deprecated
* @generated
*/
@Deprecated
public static SourcePackage getPackage() {
return SourcePackage.eINSTANCE;
}
} //SourceFactoryImpl