/** */ package de.gebit.integrity.dsl.impl; import de.gebit.integrity.dsl.DslPackage; import de.gebit.integrity.dsl.KeyValuePair; import de.gebit.integrity.dsl.ValueOrEnumValueOrOperationCollection; 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.impl.MinimalEObjectImpl; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Key Value Pair</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link de.gebit.integrity.dsl.impl.KeyValuePairImpl#getIdentifier <em>Identifier</em>}</li> * <li>{@link de.gebit.integrity.dsl.impl.KeyValuePairImpl#getStringIdentifier <em>String Identifier</em>}</li> * <li>{@link de.gebit.integrity.dsl.impl.KeyValuePairImpl#getValue <em>Value</em>}</li> * </ul> * * @generated */ public class KeyValuePairImpl extends MinimalEObjectImpl.Container implements KeyValuePair { /** * The default value of the '{@link #getIdentifier() <em>Identifier</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getIdentifier() * @generated * @ordered */ protected static final String IDENTIFIER_EDEFAULT = null; /** * The cached value of the '{@link #getIdentifier() <em>Identifier</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getIdentifier() * @generated * @ordered */ protected String identifier = IDENTIFIER_EDEFAULT; /** * The default value of the '{@link #getStringIdentifier() <em>String Identifier</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getStringIdentifier() * @generated * @ordered */ protected static final String STRING_IDENTIFIER_EDEFAULT = null; /** * The cached value of the '{@link #getStringIdentifier() <em>String Identifier</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getStringIdentifier() * @generated * @ordered */ protected String stringIdentifier = STRING_IDENTIFIER_EDEFAULT; /** * The cached value of the '{@link #getValue() <em>Value</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getValue() * @generated * @ordered */ protected ValueOrEnumValueOrOperationCollection value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected KeyValuePairImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return DslPackage.Literals.KEY_VALUE_PAIR; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getIdentifier() { return identifier; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIdentifier(String newIdentifier) { String oldIdentifier = identifier; identifier = newIdentifier; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.KEY_VALUE_PAIR__IDENTIFIER, oldIdentifier, identifier)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getStringIdentifier() { return stringIdentifier; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setStringIdentifier(String newStringIdentifier) { String oldStringIdentifier = stringIdentifier; stringIdentifier = newStringIdentifier; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.KEY_VALUE_PAIR__STRING_IDENTIFIER, oldStringIdentifier, stringIdentifier)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ValueOrEnumValueOrOperationCollection getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetValue(ValueOrEnumValueOrOperationCollection newValue, NotificationChain msgs) { ValueOrEnumValueOrOperationCollection oldValue = value; value = newValue; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DslPackage.KEY_VALUE_PAIR__VALUE, oldValue, newValue); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setValue(ValueOrEnumValueOrOperationCollection newValue) { if (newValue != value) { NotificationChain msgs = null; if (value != null) msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DslPackage.KEY_VALUE_PAIR__VALUE, null, msgs); if (newValue != null) msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DslPackage.KEY_VALUE_PAIR__VALUE, null, msgs); msgs = basicSetValue(newValue, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.KEY_VALUE_PAIR__VALUE, newValue, newValue)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case DslPackage.KEY_VALUE_PAIR__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 DslPackage.KEY_VALUE_PAIR__IDENTIFIER: return getIdentifier(); case DslPackage.KEY_VALUE_PAIR__STRING_IDENTIFIER: return getStringIdentifier(); case DslPackage.KEY_VALUE_PAIR__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 DslPackage.KEY_VALUE_PAIR__IDENTIFIER: setIdentifier((String)newValue); return; case DslPackage.KEY_VALUE_PAIR__STRING_IDENTIFIER: setStringIdentifier((String)newValue); return; case DslPackage.KEY_VALUE_PAIR__VALUE: setValue((ValueOrEnumValueOrOperationCollection)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case DslPackage.KEY_VALUE_PAIR__IDENTIFIER: setIdentifier(IDENTIFIER_EDEFAULT); return; case DslPackage.KEY_VALUE_PAIR__STRING_IDENTIFIER: setStringIdentifier(STRING_IDENTIFIER_EDEFAULT); return; case DslPackage.KEY_VALUE_PAIR__VALUE: setValue((ValueOrEnumValueOrOperationCollection)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case DslPackage.KEY_VALUE_PAIR__IDENTIFIER: return IDENTIFIER_EDEFAULT == null ? identifier != null : !IDENTIFIER_EDEFAULT.equals(identifier); case DslPackage.KEY_VALUE_PAIR__STRING_IDENTIFIER: return STRING_IDENTIFIER_EDEFAULT == null ? stringIdentifier != null : !STRING_IDENTIFIER_EDEFAULT.equals(stringIdentifier); case DslPackage.KEY_VALUE_PAIR__VALUE: return value != null; } 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(" (identifier: "); result.append(identifier); result.append(", stringIdentifier: "); result.append(stringIdentifier); result.append(')'); return result.toString(); } } //KeyValuePairImpl