blob: 8e9e89bcf71287a60a5dca2341d4f071d836b875 [file] [log] [blame]
/**
* Copyright (c) 2010 Mia-Software.
* 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:
*
* Nicolas Guyomar (Mia-Software) - initial API and implementation
*/
package org.eclipse.modisco.jee.webapp.webapp23.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.modisco.jee.webapp.webapp23.ExtensionType;
import org.eclipse.modisco.jee.webapp.webapp23.MimeMappingType;
import org.eclipse.modisco.jee.webapp.webapp23.MimeTypeType;
import org.eclipse.modisco.jee.webapp.webapp23.Webapp23Package;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Mime Mapping Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.modisco.jee.webapp.webapp23.impl.MimeMappingTypeImpl#getExtension <em>Extension</em>}</li>
* <li>{@link org.eclipse.modisco.jee.webapp.webapp23.impl.MimeMappingTypeImpl#getMimeType <em>Mime Type</em>}</li>
* <li>{@link org.eclipse.modisco.jee.webapp.webapp23.impl.MimeMappingTypeImpl#getId <em>Id</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class MimeMappingTypeImpl extends EObjectImpl implements MimeMappingType {
/**
* The cached value of the '{@link #getExtension() <em>Extension</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getExtension()
* @generated
* @ordered
*/
protected ExtensionType extension;
/**
* The cached value of the '{@link #getMimeType() <em>Mime Type</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMimeType()
* @generated
* @ordered
*/
protected MimeTypeType mimeType;
/**
* 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 MimeMappingTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return Webapp23Package.Literals.MIME_MAPPING_TYPE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ExtensionType getExtension() {
return extension;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetExtension(ExtensionType newExtension, NotificationChain msgs) {
ExtensionType oldExtension = extension;
extension = newExtension;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Webapp23Package.MIME_MAPPING_TYPE__EXTENSION, oldExtension, newExtension);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setExtension(ExtensionType newExtension) {
if (newExtension != extension) {
NotificationChain msgs = null;
if (extension != null)
msgs = ((InternalEObject)extension).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Webapp23Package.MIME_MAPPING_TYPE__EXTENSION, null, msgs);
if (newExtension != null)
msgs = ((InternalEObject)newExtension).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Webapp23Package.MIME_MAPPING_TYPE__EXTENSION, null, msgs);
msgs = basicSetExtension(newExtension, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, Webapp23Package.MIME_MAPPING_TYPE__EXTENSION, newExtension, newExtension));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public MimeTypeType getMimeType() {
return mimeType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetMimeType(MimeTypeType newMimeType, NotificationChain msgs) {
MimeTypeType oldMimeType = mimeType;
mimeType = newMimeType;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Webapp23Package.MIME_MAPPING_TYPE__MIME_TYPE, oldMimeType, newMimeType);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMimeType(MimeTypeType newMimeType) {
if (newMimeType != mimeType) {
NotificationChain msgs = null;
if (mimeType != null)
msgs = ((InternalEObject)mimeType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Webapp23Package.MIME_MAPPING_TYPE__MIME_TYPE, null, msgs);
if (newMimeType != null)
msgs = ((InternalEObject)newMimeType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Webapp23Package.MIME_MAPPING_TYPE__MIME_TYPE, null, msgs);
msgs = basicSetMimeType(newMimeType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, Webapp23Package.MIME_MAPPING_TYPE__MIME_TYPE, newMimeType, newMimeType));
}
/**
* <!-- 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, Webapp23Package.MIME_MAPPING_TYPE__ID, oldId, id));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case Webapp23Package.MIME_MAPPING_TYPE__EXTENSION:
return basicSetExtension(null, msgs);
case Webapp23Package.MIME_MAPPING_TYPE__MIME_TYPE:
return basicSetMimeType(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 Webapp23Package.MIME_MAPPING_TYPE__EXTENSION:
return getExtension();
case Webapp23Package.MIME_MAPPING_TYPE__MIME_TYPE:
return getMimeType();
case Webapp23Package.MIME_MAPPING_TYPE__ID:
return getId();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case Webapp23Package.MIME_MAPPING_TYPE__EXTENSION:
setExtension((ExtensionType)newValue);
return;
case Webapp23Package.MIME_MAPPING_TYPE__MIME_TYPE:
setMimeType((MimeTypeType)newValue);
return;
case Webapp23Package.MIME_MAPPING_TYPE__ID:
setId((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case Webapp23Package.MIME_MAPPING_TYPE__EXTENSION:
setExtension((ExtensionType)null);
return;
case Webapp23Package.MIME_MAPPING_TYPE__MIME_TYPE:
setMimeType((MimeTypeType)null);
return;
case Webapp23Package.MIME_MAPPING_TYPE__ID:
setId(ID_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case Webapp23Package.MIME_MAPPING_TYPE__EXTENSION:
return extension != null;
case Webapp23Package.MIME_MAPPING_TYPE__MIME_TYPE:
return mimeType != null;
case Webapp23Package.MIME_MAPPING_TYPE__ID:
return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
}
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(" (id: "); //$NON-NLS-1$
result.append(id);
result.append(')');
return result.toString();
}
} //MimeMappingTypeImpl