package org.eclipse.emf.texo.test.model.base.identifiable; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EDataType; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.texo.model.AbstractModelFeatureMapEntry; import org.eclipse.emf.texo.model.AbstractModelObject; import org.eclipse.emf.texo.model.ModelFactory; import org.eclipse.emf.texo.model.ModelFeatureMapEntry; import org.eclipse.emf.texo.model.ModelObject; import org.eclipse.emf.texo.model.ModelPackage; /** * The <b>{@link ModelFactory}</b> for the types of this model: identifiable. It contains code to create instances * {@link ModelObject} wrappers and instances for EClasses and convert objects back and forth from their String (XML) * representation. <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public class IdentifiableModelFactory implements ModelFactory { /** * Creates an instance for an {@link EClass} <!-- begin-user-doc --> <!-- end-user-doc --> * * @param eClass * creates a Object instance for this EClass * @return an object representing the eClass * @generated */ public Object create(EClass eClass) { switch (eClass.getClassifierID()) { case IdentifiableModelPackage.NOTIDENTIFIABLE_CLASSIFIER_ID: return createNotIdentifiable(); default: throw new IllegalArgumentException("The EClass '" + eClass.getName() + "' is not a valid EClass for this EPackage"); } } /** * Wraps an object in a {@link ModelObject}. <!-- begin-user-doc --> <!-- end-user-doc --> * * @param eClass * the EClass of the object * @param adaptee * the object being wrapped/adapted * @return the wrapper {@link ModelObject} * @generated */ @SuppressWarnings({ "unchecked", "rawtypes" }) public <T> ModelObject<T> createModelObject(EClass eClass, T adaptee) { ModelObject<Object> modelObject = null; switch (eClass.getClassifierID()) { case IdentifiableModelPackage.IDENTIFIABLE_CLASSIFIER_ID: modelObject = new IdentifiableModelObject(); break; case IdentifiableModelPackage.NOTIDENTIFIABLE_CLASSIFIER_ID: modelObject = new NotIdentifiableModelObject(); break; case IdentifiableModelPackage.IDENTIFIABLEINTERFACE_CLASSIFIER_ID: modelObject = new IdentifiableInterfaceModelObject(); break; default: throw new IllegalArgumentException("The EClass '" + eClass + "' is not defined in this EPackage"); } modelObject.setTarget(adaptee); return (ModelObject<T>) modelObject; } /** * Creates a feature map entry instance for a certain EStructuralFeature. * * @param eFeature * the feature map feature * @return the pojo feature map entry * @generated */ public Object createFeatureMapEntry(EStructuralFeature eFeature) { throw new IllegalArgumentException("The EStructuralFeature '" + eFeature + "' is not a valid feature map in this EPackage"); } /** * Wraps a feature map entry pojo in a {@link AbstractModelFeatureMapEntry}. If the feature map entry is null then a * new one is created and <!-- begin-user-doc --> <!-- end-user-doc --> * * @param eFeature * the feature map feature of the object * @param adaptee * the pojo feature map entry being wrapped/adapted * @return the wrapper {@link ModelFeatureMapEntry} * @generated */ public ModelFeatureMapEntry<?> createModelFeatureMapEntry(EStructuralFeature eFeature, Object adaptee) { throw new IllegalArgumentException("The EStructuralFeature '" + eFeature + "' is not a valid feature map in this EPackage"); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @return an instance of the model object representing the EClass NotIdentifiable * @generated */ public NotIdentifiable createNotIdentifiable() { return new NotIdentifiable(); } /** * Converts an instance of an {@link EDataType} to a String. <!-- begin-user-doc --> <!-- end-user-doc --> * * @param eDataType * the {@link EDataType} defining the type * @param value * the object to convert, if the value is null then null is returned. * @generated */ public Object createFromString(EDataType eDataType, String value) { switch (eDataType.getClassifierID()) { default: throw new IllegalArgumentException("The EDatatype '" + eDataType + "' is not defined in this EPackage"); } } /** * Converts an instance of an {@link EDataType} to a String. <!-- begin-user-doc --> <!-- end-user-doc --> * * @param eDataType * the {@link EDataType} defining the type * @param value * the object to convert, if value == null then null is returned * @generated */ public String convertToString(EDataType eDataType, Object value) { switch (eDataType.getClassifierID()) { default: throw new IllegalArgumentException("The EDatatype '" + eDataType + "' is not defined in this EPackage."); } } /** * The adapter/wrapper for the EClass '<em><b>Identifiable</b></em>'. * * <!-- begin-user-doc --> <!-- end-user-doc --> * * @param <E> * the domain model java class * * @generated */ public static class IdentifiableModelObject<E extends Identifiable> extends AbstractModelObject<E> { /** * @generated */ public EClass eClass() { return IdentifiableModelPackage.INSTANCE.getIdentifiableEClass(); } /** * @generated */ public ModelPackage getModelPackage() { return IdentifiableModelPackage.INSTANCE; } /** * @generated */ @Override public Class<?> getTargetClass() { return Identifiable.class; } /** * @generated */ @Override public Object eGet(EStructuralFeature eStructuralFeature) { final int featureID = eClass().getFeatureID(eStructuralFeature); switch (featureID) { case IdentifiableModelPackage.IDENTIFIABLE_DB_ID_FEATURE_ID: return getTarget().getDb_Id(); case IdentifiableModelPackage.IDENTIFIABLE_DB_VERSION_FEATURE_ID: return getTarget().getDb_version(); default: return super.eGet(eStructuralFeature); } } /** * @generated */ @Override public void eSet(EStructuralFeature eStructuralFeature, Object value) { final int featureID = eClass().getFeatureID(eStructuralFeature); switch (featureID) { case IdentifiableModelPackage.IDENTIFIABLE_DB_ID_FEATURE_ID: getTarget().setDb_Id((Long) value); return; case IdentifiableModelPackage.IDENTIFIABLE_DB_VERSION_FEATURE_ID: getTarget().setDb_version((Integer) value); return; default: super.eSet(eStructuralFeature, value); } } /** * @generated */ @Override public boolean eAddTo(EStructuralFeature eStructuralFeature, Object value) { final int featureID = eClass().getFeatureID(eStructuralFeature); switch (featureID) { default: return super.eAddTo(eStructuralFeature, value); } } /** * @generated */ @Override public boolean eRemoveFrom(EStructuralFeature eStructuralFeature, Object value) { final int featureID = eClass().getFeatureID(eStructuralFeature); switch (featureID) { default: return super.eRemoveFrom(eStructuralFeature, value); } } } /** * The adapter/wrapper for the EClass '<em><b>NotIdentifiable</b></em>'. * * <!-- begin-user-doc --> <!-- end-user-doc --> * * @param <E> * the domain model java class * * @generated */ public static class NotIdentifiableModelObject<E extends NotIdentifiable> extends AbstractModelObject<E> { /** * @generated */ public EClass eClass() { return IdentifiableModelPackage.INSTANCE.getNotIdentifiableEClass(); } /** * @generated */ public ModelPackage getModelPackage() { return IdentifiableModelPackage.INSTANCE; } /** * @generated */ @Override public Class<?> getTargetClass() { return NotIdentifiable.class; } /** * @generated */ @Override public Object eGet(EStructuralFeature eStructuralFeature) { final int featureID = eClass().getFeatureID(eStructuralFeature); switch (featureID) { default: return super.eGet(eStructuralFeature); } } /** * @generated */ @Override public void eSet(EStructuralFeature eStructuralFeature, Object value) { final int featureID = eClass().getFeatureID(eStructuralFeature); switch (featureID) { default: super.eSet(eStructuralFeature, value); } } /** * @generated */ @Override public boolean eAddTo(EStructuralFeature eStructuralFeature, Object value) { final int featureID = eClass().getFeatureID(eStructuralFeature); switch (featureID) { default: return super.eAddTo(eStructuralFeature, value); } } /** * @generated */ @Override public boolean eRemoveFrom(EStructuralFeature eStructuralFeature, Object value) { final int featureID = eClass().getFeatureID(eStructuralFeature); switch (featureID) { default: return super.eRemoveFrom(eStructuralFeature, value); } } } /** * The adapter/wrapper for the EClass '<em><b>IdentifiableInterface</b></em>'. * * <!-- begin-user-doc --> <!-- end-user-doc --> * * @param <E> * the domain model java class * * @generated */ public static class IdentifiableInterfaceModelObject<E extends IdentifiableInterface> extends AbstractModelObject<E> { /** * @generated */ public EClass eClass() { return IdentifiableModelPackage.INSTANCE.getIdentifiableInterfaceEClass(); } /** * @generated */ public ModelPackage getModelPackage() { return IdentifiableModelPackage.INSTANCE; } /** * @generated */ @Override public Class<?> getTargetClass() { return IdentifiableInterface.class; } /** * @generated */ @Override public Object eGet(EStructuralFeature eStructuralFeature) { final int featureID = eClass().getFeatureID(eStructuralFeature); switch (featureID) { case IdentifiableModelPackage.IDENTIFIABLEINTERFACE_DB_ID_FEATURE_ID: return getTarget().getDb_Id(); case IdentifiableModelPackage.IDENTIFIABLEINTERFACE_DB_VERSION_FEATURE_ID: return getTarget().getDb_version(); default: return super.eGet(eStructuralFeature); } } /** * @generated */ @Override public void eSet(EStructuralFeature eStructuralFeature, Object value) { final int featureID = eClass().getFeatureID(eStructuralFeature); switch (featureID) { case IdentifiableModelPackage.IDENTIFIABLEINTERFACE_DB_ID_FEATURE_ID: getTarget().setDb_Id((Long) value); return; case IdentifiableModelPackage.IDENTIFIABLEINTERFACE_DB_VERSION_FEATURE_ID: getTarget().setDb_version((Integer) value); return; default: super.eSet(eStructuralFeature, value); } } /** * @generated */ @Override public boolean eAddTo(EStructuralFeature eStructuralFeature, Object value) { final int featureID = eClass().getFeatureID(eStructuralFeature); switch (featureID) { default: return super.eAddTo(eStructuralFeature, value); } } /** * @generated */ @Override public boolean eRemoveFrom(EStructuralFeature eStructuralFeature, Object value) { final int featureID = eClass().getFeatureID(eStructuralFeature); switch (featureID) { default: return super.eRemoveFrom(eStructuralFeature, value); } } } }