/** * <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.ResourceLocator; import orgomg.cwm.objectmodel.core.impl.ModelElementImpl; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Resource Locator</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link orgomg.cwm.foundation.businessinformation.impl.ResourceLocatorImpl#getUrl <em>Url</em>}</li> * <li>{@link orgomg.cwm.foundation.businessinformation.impl.ResourceLocatorImpl#getContact <em>Contact</em>}</li> * </ul> * </p> * * @generated */ public class ResourceLocatorImpl extends ModelElementImpl implements ResourceLocator { /** * The default value of the '{@link #getUrl() <em>Url</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getUrl() * @generated * @ordered */ protected static final String URL_EDEFAULT = null; /** * The cached value of the '{@link #getUrl() <em>Url</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getUrl() * @generated * @ordered */ protected String url = URL_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 ResourceLocatorImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return BusinessinformationPackage.Literals.RESOURCE_LOCATOR; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getUrl() { return url; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setUrl(String newUrl) { String oldUrl = url; url = newUrl; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, BusinessinformationPackage.RESOURCE_LOCATOR__URL, oldUrl, url)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Contact> getContact() { if (contact == null) { contact = new EObjectWithInverseResolvingEList.ManyInverse<Contact>(Contact.class, this, BusinessinformationPackage.RESOURCE_LOCATOR__CONTACT, BusinessinformationPackage.CONTACT__URL); } 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.RESOURCE_LOCATOR__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.RESOURCE_LOCATOR__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.RESOURCE_LOCATOR__URL: return getUrl(); case BusinessinformationPackage.RESOURCE_LOCATOR__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.RESOURCE_LOCATOR__URL: setUrl((String)newValue); return; case BusinessinformationPackage.RESOURCE_LOCATOR__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.RESOURCE_LOCATOR__URL: setUrl(URL_EDEFAULT); return; case BusinessinformationPackage.RESOURCE_LOCATOR__CONTACT: getContact().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case BusinessinformationPackage.RESOURCE_LOCATOR__URL: return URL_EDEFAULT == null ? url != null : !URL_EDEFAULT.equals(url); case BusinessinformationPackage.RESOURCE_LOCATOR__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(" (url: "); result.append(url); result.append(')'); return result.toString(); } } //ResourceLocatorImpl