| /*************************************************************************************************** |
| * Copyright (c) 2005, 2006 IBM Corporation and others. |
| * 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: |
| * IBM Corporation - initial API and implementation |
| * Oracle Corporation - revision |
| **************************************************************************************************/ |
| package org.eclipse.jst.jsf.facesconfig.emf.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.InternalEObject; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.EObjectImpl; |
| import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage; |
| import org.eclipse.jst.jsf.facesconfig.emf.KeyType; |
| import org.eclipse.jst.jsf.facesconfig.emf.MapEntryType; |
| import org.eclipse.jst.jsf.facesconfig.emf.NullValueType; |
| import org.eclipse.jst.jsf.facesconfig.emf.ValueType; |
| |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Map Entry Type</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.jst.jsf.facesconfig.emf.impl.MapEntryTypeImpl#getKey <em>Key</em>}</li> |
| * <li>{@link org.eclipse.jst.jsf.facesconfig.emf.impl.MapEntryTypeImpl#getNullValue <em>Null Value</em>}</li> |
| * <li>{@link org.eclipse.jst.jsf.facesconfig.emf.impl.MapEntryTypeImpl#getValue <em>Value</em>}</li> |
| * <li>{@link org.eclipse.jst.jsf.facesconfig.emf.impl.MapEntryTypeImpl#getId <em>Id</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class MapEntryTypeImpl extends EObjectImpl implements MapEntryType { |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static final String copyright = "Copyright (c) 2005, 2006 IBM Corporation and others"; |
| |
| /** |
| * The cached value of the '{@link #getKey() <em>Key</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getKey() |
| * @generated |
| * @ordered |
| */ |
| protected KeyType key = null; |
| |
| /** |
| * The cached value of the '{@link #getNullValue() <em>Null Value</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getNullValue() |
| * @generated |
| * @ordered |
| */ |
| protected NullValueType nullValue = null; |
| |
| /** |
| * The cached value of the '{@link #getValue() <em>Value</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getValue() |
| * @generated |
| * @ordered |
| */ |
| protected ValueType value = null; |
| |
| /** |
| * The default value of the '{@link #getId() <em>Id</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getId() |
| * @generated |
| * @ordered |
| */ |
| protected static final String ID_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getId() <em>Id</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getId() |
| * @generated |
| * @ordered |
| */ |
| protected String id = ID_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected MapEntryTypeImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected EClass eStaticClass() { |
| return FacesConfigPackage.Literals.MAP_ENTRY_TYPE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public KeyType getKey() { |
| return key; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * @param newKey |
| * @param msgs |
| * @return the notification chain |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetKey(KeyType newKey, NotificationChain msgs) { |
| KeyType oldKey = key; |
| key = newKey; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FacesConfigPackage.MAP_ENTRY_TYPE__KEY, oldKey, newKey); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setKey(KeyType newKey) { |
| if (newKey != key) { |
| NotificationChain msgs = null; |
| if (key != null) |
| msgs = ((InternalEObject)key).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FacesConfigPackage.MAP_ENTRY_TYPE__KEY, null, msgs); |
| if (newKey != null) |
| msgs = ((InternalEObject)newKey).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FacesConfigPackage.MAP_ENTRY_TYPE__KEY, null, msgs); |
| msgs = basicSetKey(newKey, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FacesConfigPackage.MAP_ENTRY_TYPE__KEY, newKey, newKey)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NullValueType getNullValue() { |
| return nullValue; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * @param newNullValue |
| * @param msgs |
| * @return the notification chain |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetNullValue(NullValueType newNullValue, NotificationChain msgs) { |
| NullValueType oldNullValue = nullValue; |
| nullValue = newNullValue; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FacesConfigPackage.MAP_ENTRY_TYPE__NULL_VALUE, oldNullValue, newNullValue); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setNullValue(NullValueType newNullValue) { |
| if (newNullValue != nullValue) { |
| NotificationChain msgs = null; |
| if (nullValue != null) |
| msgs = ((InternalEObject)nullValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FacesConfigPackage.MAP_ENTRY_TYPE__NULL_VALUE, null, msgs); |
| if (newNullValue != null) |
| msgs = ((InternalEObject)newNullValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FacesConfigPackage.MAP_ENTRY_TYPE__NULL_VALUE, null, msgs); |
| msgs = basicSetNullValue(newNullValue, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FacesConfigPackage.MAP_ENTRY_TYPE__NULL_VALUE, newNullValue, newNullValue)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ValueType getValue() { |
| return value; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * @param newValue |
| * @param msgs |
| * @return the notification chain |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetValue(ValueType newValue, NotificationChain msgs) { |
| ValueType oldValue = value; |
| value = newValue; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FacesConfigPackage.MAP_ENTRY_TYPE__VALUE, oldValue, newValue); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setValue(ValueType newValue) { |
| if (newValue != value) { |
| NotificationChain msgs = null; |
| if (value != null) |
| msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FacesConfigPackage.MAP_ENTRY_TYPE__VALUE, null, msgs); |
| if (newValue != null) |
| msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FacesConfigPackage.MAP_ENTRY_TYPE__VALUE, null, msgs); |
| msgs = basicSetValue(newValue, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FacesConfigPackage.MAP_ENTRY_TYPE__VALUE, newValue, newValue)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getId() { |
| return id; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setId(String newId) { |
| String oldId = id; |
| id = newId; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FacesConfigPackage.MAP_ENTRY_TYPE__ID, oldId, id)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FacesConfigPackage.MAP_ENTRY_TYPE__KEY: |
| return basicSetKey(null, msgs); |
| case FacesConfigPackage.MAP_ENTRY_TYPE__NULL_VALUE: |
| return basicSetNullValue(null, msgs); |
| case FacesConfigPackage.MAP_ENTRY_TYPE__VALUE: |
| return basicSetValue(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case FacesConfigPackage.MAP_ENTRY_TYPE__KEY: |
| return getKey(); |
| case FacesConfigPackage.MAP_ENTRY_TYPE__NULL_VALUE: |
| return getNullValue(); |
| case FacesConfigPackage.MAP_ENTRY_TYPE__VALUE: |
| return getValue(); |
| case FacesConfigPackage.MAP_ENTRY_TYPE__ID: |
| return getId(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case FacesConfigPackage.MAP_ENTRY_TYPE__KEY: |
| setKey((KeyType)newValue); |
| return; |
| case FacesConfigPackage.MAP_ENTRY_TYPE__NULL_VALUE: |
| setNullValue((NullValueType)newValue); |
| return; |
| case FacesConfigPackage.MAP_ENTRY_TYPE__VALUE: |
| setValue((ValueType)newValue); |
| return; |
| case FacesConfigPackage.MAP_ENTRY_TYPE__ID: |
| setId((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FacesConfigPackage.MAP_ENTRY_TYPE__KEY: |
| setKey((KeyType)null); |
| return; |
| case FacesConfigPackage.MAP_ENTRY_TYPE__NULL_VALUE: |
| setNullValue((NullValueType)null); |
| return; |
| case FacesConfigPackage.MAP_ENTRY_TYPE__VALUE: |
| setValue((ValueType)null); |
| return; |
| case FacesConfigPackage.MAP_ENTRY_TYPE__ID: |
| setId(ID_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FacesConfigPackage.MAP_ENTRY_TYPE__KEY: |
| return key != null; |
| case FacesConfigPackage.MAP_ENTRY_TYPE__NULL_VALUE: |
| return nullValue != null; |
| case FacesConfigPackage.MAP_ENTRY_TYPE__VALUE: |
| return value != null; |
| case FacesConfigPackage.MAP_ENTRY_TYPE__ID: |
| return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (id: "); |
| result.append(id); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //MapEntryTypeImpl |