/******************************************************************************* * Copyright (c) 2008-2011 Chair for Applied Software Engineering, * Technische Universitaet Muenchen. * 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: ******************************************************************************/ package org.eclipse.emf.emfstore.common.model.impl; 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.EObject; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.EObjectImpl; import org.eclipse.emf.emfstore.common.model.EMFStoreProperty; import org.eclipse.emf.emfstore.common.model.EMFStorePropertyType; import org.eclipse.emf.emfstore.common.model.ModelPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>EMF Store Property</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.emf.emfstore.common.model.impl.EMFStorePropertyImpl#getKey <em>Key</em>}</li> * <li>{@link org.eclipse.emf.emfstore.common.model.impl.EMFStorePropertyImpl#getValue <em>Value</em>}</li> * <li>{@link org.eclipse.emf.emfstore.common.model.impl.EMFStorePropertyImpl#getType <em>Type</em>}</li> * </ul> * </p> * * @generated */ public class EMFStorePropertyImpl extends EObjectImpl implements EMFStoreProperty { /** * The default value of the '{@link #getKey() <em>Key</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @see #getKey() * @generated * @ordered */ protected static final String KEY_EDEFAULT = null; /** * The cached value of the '{@link #getKey() <em>Key</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @see #getKey() * @generated * @ordered */ protected String key = KEY_EDEFAULT; /** * The cached value of the '{@link #getValue() <em>Value</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @see #getValue() * @generated * @ordered */ protected EObject value; /** * The default value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @see #getType() * @generated * @ordered */ protected static final EMFStorePropertyType TYPE_EDEFAULT = EMFStorePropertyType.SHARED; /** * The cached value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @see #getType() * @generated * @ordered */ protected EMFStorePropertyType type = TYPE_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ protected EMFStorePropertyImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override protected EClass eStaticClass() { return ModelPackage.Literals.EMF_STORE_PROPERTY; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public String getKey() { return key; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public void setKey(String newKey) { String oldKey = key; key = newKey; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.EMF_STORE_PROPERTY__KEY, oldKey, key)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public EObject getValue() { if (value != null && value.eIsProxy()) { InternalEObject oldValue = (InternalEObject) value; value = eResolveProxy(oldValue); if (value != oldValue) { InternalEObject newValue = (InternalEObject) value; NotificationChain msgs = oldValue.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ModelPackage.EMF_STORE_PROPERTY__VALUE, null, null); if (newValue.eInternalContainer() == null) { msgs = newValue.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModelPackage.EMF_STORE_PROPERTY__VALUE, null, msgs); } if (msgs != null) msgs.dispatch(); if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackage.EMF_STORE_PROPERTY__VALUE, oldValue, value)); } } return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public EObject basicGetValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public NotificationChain basicSetValue(EObject newValue, NotificationChain msgs) { EObject oldValue = value; value = newValue; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelPackage.EMF_STORE_PROPERTY__VALUE, oldValue, newValue); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public void setValue(EObject newValue) { if (newValue != value) { NotificationChain msgs = null; if (value != null) msgs = ((InternalEObject) value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ModelPackage.EMF_STORE_PROPERTY__VALUE, null, msgs); if (newValue != null) msgs = ((InternalEObject) newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModelPackage.EMF_STORE_PROPERTY__VALUE, null, msgs); msgs = basicSetValue(newValue, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.EMF_STORE_PROPERTY__VALUE, newValue, newValue)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public EMFStorePropertyType getType() { return type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public void setType(EMFStorePropertyType newType) { EMFStorePropertyType oldType = type; type = newType == null ? TYPE_EDEFAULT : newType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.EMF_STORE_PROPERTY__TYPE, oldType, type)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ModelPackage.EMF_STORE_PROPERTY__VALUE: return basicSetValue(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case ModelPackage.EMF_STORE_PROPERTY__KEY: return getKey(); case ModelPackage.EMF_STORE_PROPERTY__VALUE: if (resolve) return getValue(); return basicGetValue(); case ModelPackage.EMF_STORE_PROPERTY__TYPE: return getType(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ModelPackage.EMF_STORE_PROPERTY__KEY: setKey((String) newValue); return; case ModelPackage.EMF_STORE_PROPERTY__VALUE: setValue((EObject) newValue); return; case ModelPackage.EMF_STORE_PROPERTY__TYPE: setType((EMFStorePropertyType) newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ModelPackage.EMF_STORE_PROPERTY__KEY: setKey(KEY_EDEFAULT); return; case ModelPackage.EMF_STORE_PROPERTY__VALUE: setValue((EObject) null); return; case ModelPackage.EMF_STORE_PROPERTY__TYPE: setType(TYPE_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ModelPackage.EMF_STORE_PROPERTY__KEY: return KEY_EDEFAULT == null ? key != null : !KEY_EDEFAULT.equals(key); case ModelPackage.EMF_STORE_PROPERTY__VALUE: return value != null; case ModelPackage.EMF_STORE_PROPERTY__TYPE: return type != TYPE_EDEFAULT; } 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(" (key: "); result.append(key); result.append(", type: "); result.append(type); result.append(')'); return result.toString(); } } // EMFStorePropertyImpl