blob: 0579d04280349d824820f05724d14f454d07af05 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2014 Hussein Mhanna
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Hussein Mhanna - initial API and implementation
******************************************************************************/
package org.eclipse.rmf.reqif10.csv.importer.mapping.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.rmf.reqif10.csv.importer.mapping.DataType;
import org.eclipse.rmf.reqif10.csv.importer.mapping.MappingItem;
import org.eclipse.rmf.reqif10.csv.importer.mapping.MappingPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Item</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.rmf.reqif10.csv.importer.mapping.impl.MappingItemImpl#getAttributeName <em>Attribute Name</em>}</li>
* <li>{@link org.eclipse.rmf.reqif10.csv.importer.mapping.impl.MappingItemImpl#getDataType <em>Data Type</em>}</li>
* <li>{@link org.eclipse.rmf.reqif10.csv.importer.mapping.impl.MappingItemImpl#getColumnId <em>Column Id</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class MappingItemImpl extends MinimalEObjectImpl.Container implements MappingItem {
/**
* The default value of the '{@link #getAttributeName() <em>Attribute Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAttributeName()
* @generated
* @ordered
*/
protected static final String ATTRIBUTE_NAME_EDEFAULT = "";
/**
* The cached value of the '{@link #getAttributeName() <em>Attribute Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAttributeName()
* @generated
* @ordered
*/
protected String attributeName = ATTRIBUTE_NAME_EDEFAULT;
/**
* The default value of the '{@link #getDataType() <em>Data Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDataType()
* @generated
* @ordered
*/
protected static final DataType DATA_TYPE_EDEFAULT = DataType.STRING;
/**
* The cached value of the '{@link #getDataType() <em>Data Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDataType()
* @generated
* @ordered
*/
protected DataType dataType = DATA_TYPE_EDEFAULT;
/**
* The default value of the '{@link #getColumnId() <em>Column Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getColumnId()
* @generated
* @ordered
*/
protected static final String COLUMN_ID_EDEFAULT = "";
/**
* The cached value of the '{@link #getColumnId() <em>Column Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getColumnId()
* @generated
* @ordered
*/
protected String columnId = COLUMN_ID_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MappingItemImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return MappingPackage.Literals.MAPPING_ITEM;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getAttributeName() {
return attributeName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAttributeName(String newAttributeName) {
String oldAttributeName = attributeName;
attributeName = newAttributeName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.MAPPING_ITEM__ATTRIBUTE_NAME, oldAttributeName, attributeName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataType getDataType() {
return dataType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDataType(DataType newDataType) {
DataType oldDataType = dataType;
dataType = newDataType == null ? DATA_TYPE_EDEFAULT : newDataType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.MAPPING_ITEM__DATA_TYPE, oldDataType, dataType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getColumnId() {
return columnId;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setColumnId(String newColumnId) {
String oldColumnId = columnId;
columnId = newColumnId;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.MAPPING_ITEM__COLUMN_ID, oldColumnId, columnId));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case MappingPackage.MAPPING_ITEM__ATTRIBUTE_NAME:
return getAttributeName();
case MappingPackage.MAPPING_ITEM__DATA_TYPE:
return getDataType();
case MappingPackage.MAPPING_ITEM__COLUMN_ID:
return getColumnId();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case MappingPackage.MAPPING_ITEM__ATTRIBUTE_NAME:
setAttributeName((String)newValue);
return;
case MappingPackage.MAPPING_ITEM__DATA_TYPE:
setDataType((DataType)newValue);
return;
case MappingPackage.MAPPING_ITEM__COLUMN_ID:
setColumnId((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case MappingPackage.MAPPING_ITEM__ATTRIBUTE_NAME:
setAttributeName(ATTRIBUTE_NAME_EDEFAULT);
return;
case MappingPackage.MAPPING_ITEM__DATA_TYPE:
setDataType(DATA_TYPE_EDEFAULT);
return;
case MappingPackage.MAPPING_ITEM__COLUMN_ID:
setColumnId(COLUMN_ID_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case MappingPackage.MAPPING_ITEM__ATTRIBUTE_NAME:
return ATTRIBUTE_NAME_EDEFAULT == null ? attributeName != null : !ATTRIBUTE_NAME_EDEFAULT.equals(attributeName);
case MappingPackage.MAPPING_ITEM__DATA_TYPE:
return dataType != DATA_TYPE_EDEFAULT;
case MappingPackage.MAPPING_ITEM__COLUMN_ID:
return COLUMN_ID_EDEFAULT == null ? columnId != null : !COLUMN_ID_EDEFAULT.equals(columnId);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (attributeName: ");
result.append(attributeName);
result.append(", dataType: ");
result.append(dataType);
result.append(", columnId: ");
result.append(columnId);
result.append(')');
return result.toString();
}
} //MappingItemImpl