/**
* <copyright>
* </copyright>
*
* $Id$
*/
package orgomg.cwm.foundation.businessinformation.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
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.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
import orgomg.cwm.foundation.businessinformation.BusinessinformationPackage;
import orgomg.cwm.foundation.businessinformation.Contact;
import orgomg.cwm.foundation.businessinformation.Email;
import orgomg.cwm.objectmodel.core.impl.ModelElementImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Email</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link orgomg.cwm.foundation.businessinformation.impl.EmailImpl#getEmailAddress <em>Email Address</em>}</li>
* <li>{@link orgomg.cwm.foundation.businessinformation.impl.EmailImpl#getEmailType <em>Email Type</em>}</li>
* <li>{@link orgomg.cwm.foundation.businessinformation.impl.EmailImpl#getContact <em>Contact</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class EmailImpl extends ModelElementImpl implements Email {
/**
* The default value of the '{@link #getEmailAddress() <em>Email Address</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEmailAddress()
* @generated
* @ordered
*/
protected static final String EMAIL_ADDRESS_EDEFAULT = null;
/**
* The cached value of the '{@link #getEmailAddress() <em>Email Address</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEmailAddress()
* @generated
* @ordered
*/
protected String emailAddress = EMAIL_ADDRESS_EDEFAULT;
/**
* The default value of the '{@link #getEmailType() <em>Email Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEmailType()
* @generated
* @ordered
*/
protected static final String EMAIL_TYPE_EDEFAULT = null;
/**
* The cached value of the '{@link #getEmailType() <em>Email Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEmailType()
* @generated
* @ordered
*/
protected String emailType = EMAIL_TYPE_EDEFAULT;
/**
* The cached value of the '{@link #getContact() <em>Contact</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getContact()
* @generated
* @ordered
*/
protected EList<Contact> contact;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EmailImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return BusinessinformationPackage.Literals.EMAIL;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getEmailAddress() {
return emailAddress;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEmailAddress(String newEmailAddress) {
String oldEmailAddress = emailAddress;
emailAddress = newEmailAddress;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BusinessinformationPackage.EMAIL__EMAIL_ADDRESS, oldEmailAddress, emailAddress));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getEmailType() {
return emailType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEmailType(String newEmailType) {
String oldEmailType = emailType;
emailType = newEmailType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BusinessinformationPackage.EMAIL__EMAIL_TYPE, oldEmailType, emailType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Contact> getContact() {
if (contact == null) {
contact = new EObjectWithInverseResolvingEList.ManyInverse<Contact>(Contact.class, this, BusinessinformationPackage.EMAIL__CONTACT, BusinessinformationPackage.CONTACT__EMAIL);
}
return contact;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case BusinessinformationPackage.EMAIL__CONTACT:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getContact()).basicAdd(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 BusinessinformationPackage.EMAIL__CONTACT:
return ((InternalEList<?>)getContact()).basicRemove(otherEnd, 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 BusinessinformationPackage.EMAIL__EMAIL_ADDRESS:
return getEmailAddress();
case BusinessinformationPackage.EMAIL__EMAIL_TYPE:
return getEmailType();
case BusinessinformationPackage.EMAIL__CONTACT:
return getContact();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case BusinessinformationPackage.EMAIL__EMAIL_ADDRESS:
setEmailAddress((String)newValue);
return;
case BusinessinformationPackage.EMAIL__EMAIL_TYPE:
setEmailType((String)newValue);
return;
case BusinessinformationPackage.EMAIL__CONTACT:
getContact().clear();
getContact().addAll((Collection<? extends Contact>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case BusinessinformationPackage.EMAIL__EMAIL_ADDRESS:
setEmailAddress(EMAIL_ADDRESS_EDEFAULT);
return;
case BusinessinformationPackage.EMAIL__EMAIL_TYPE:
setEmailType(EMAIL_TYPE_EDEFAULT);
return;
case BusinessinformationPackage.EMAIL__CONTACT:
getContact().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case BusinessinformationPackage.EMAIL__EMAIL_ADDRESS:
return EMAIL_ADDRESS_EDEFAULT == null ? emailAddress != null : !EMAIL_ADDRESS_EDEFAULT.equals(emailAddress);
case BusinessinformationPackage.EMAIL__EMAIL_TYPE:
return EMAIL_TYPE_EDEFAULT == null ? emailType != null : !EMAIL_TYPE_EDEFAULT.equals(emailType);
case BusinessinformationPackage.EMAIL__CONTACT:
return contact != null && !contact.isEmpty();
}
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(" (emailAddress: ");
result.append(emailAddress);
result.append(", emailType: ");
result.append(emailType);
result.append(')');
return result.toString();
}
} //EmailImpl