/**
*/
package com.rcpcompany.uibindings.tests.shop.internal;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import com.rcpcompany.uibindings.moao.internal.NamedObjectImpl;
import com.rcpcompany.uibindings.tests.shop.ShopItem;
import com.rcpcompany.uibindings.tests.shop.ShopItemProperties;
import com.rcpcompany.uibindings.tests.shop.ShopPackage;
/**
* <!-- begin-user-doc --> An implementation of the model object '<em><b>Item Properties</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link com.rcpcompany.uibindings.tests.shop.internal.ShopItemPropertiesImpl#getItem <em>Item
* </em>}</li>
* <li>{@link com.rcpcompany.uibindings.tests.shop.internal.ShopItemPropertiesImpl#getValue <em>
* Value</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ShopItemPropertiesImpl extends NamedObjectImpl implements ShopItemProperties {
/**
* The default value of the '{@link #getValue() <em>Value</em>}' attribute. <!-- begin-user-doc
* --> <!-- end-user-doc -->
*
* @see #getValue()
* @generated
* @ordered
*/
protected static final String VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getValue() <em>Value</em>}' attribute. <!-- begin-user-doc
* --> <!-- end-user-doc -->
*
* @see #getValue()
* @generated
* @ordered
*/
protected String value = VALUE_EDEFAULT;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected ShopItemPropertiesImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ShopPackage.Literals.SHOP_ITEM_PROPERTIES;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public ShopItem getItem() {
if (eContainerFeatureID() != ShopPackage.SHOP_ITEM_PROPERTIES__ITEM) return null;
return (ShopItem) eInternalContainer();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetItem(ShopItem newItem, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject) newItem, ShopPackage.SHOP_ITEM_PROPERTIES__ITEM, msgs);
return msgs;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setItem(ShopItem newItem) {
if (newItem != eInternalContainer()
|| (eContainerFeatureID() != ShopPackage.SHOP_ITEM_PROPERTIES__ITEM && newItem != null)) {
if (EcoreUtil.isAncestor(this, newItem))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); //$NON-NLS-1$
NotificationChain msgs = null;
if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs);
if (newItem != null)
msgs = ((InternalEObject) newItem).eInverseAdd(this, ShopPackage.SHOP_ITEM__PROPERTIES, ShopItem.class,
msgs);
msgs = basicSetItem(newItem, msgs);
if (msgs != null) msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ShopPackage.SHOP_ITEM_PROPERTIES__ITEM, newItem,
newItem));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public String getValue() {
return value;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setValue(String newValue) {
String oldValue = value;
value = newValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ShopPackage.SHOP_ITEM_PROPERTIES__VALUE, oldValue,
value));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ShopPackage.SHOP_ITEM_PROPERTIES__ITEM:
if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs);
return basicSetItem((ShopItem) otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ShopPackage.SHOP_ITEM_PROPERTIES__ITEM:
return basicSetItem(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case ShopPackage.SHOP_ITEM_PROPERTIES__ITEM:
return eInternalContainer().eInverseRemove(this, ShopPackage.SHOP_ITEM__PROPERTIES, ShopItem.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ShopPackage.SHOP_ITEM_PROPERTIES__ITEM:
return getItem();
case ShopPackage.SHOP_ITEM_PROPERTIES__VALUE:
return getValue();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ShopPackage.SHOP_ITEM_PROPERTIES__ITEM:
setItem((ShopItem) newValue);
return;
case ShopPackage.SHOP_ITEM_PROPERTIES__VALUE:
setValue((String) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ShopPackage.SHOP_ITEM_PROPERTIES__ITEM:
setItem((ShopItem) null);
return;
case ShopPackage.SHOP_ITEM_PROPERTIES__VALUE:
setValue(VALUE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ShopPackage.SHOP_ITEM_PROPERTIES__ITEM:
return getItem() != null;
case ShopPackage.SHOP_ITEM_PROPERTIES__VALUE:
return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
}
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(" (value: "); //$NON-NLS-1$
result.append(value);
result.append(')');
return result.toString();
}
} // ShopItemPropertiesImpl