/**
* <copyright> </copyright>
*
* $Id: ConnectionItemImpl.java 75298 2011-12-26 09:56:31Z nrousseau $
*/
package org.talend.core.model.properties.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.talend.core.model.metadata.builder.connection.Connection;
import org.talend.core.model.properties.ConnectionItem;
import org.talend.core.model.properties.PropertiesPackage;
/**
* <!-- begin-user-doc --> An implementation of the model object '<em><b>Connection Item</b></em>'. <!--
* end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.talend.core.model.properties.impl.ConnectionItemImpl#getConnection <em>Connection</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ConnectionItemImpl extends ItemImpl implements ConnectionItem {
/**
* The cached value of the '{@link #getConnection() <em>Connection</em>}' reference.
* <!-- begin-user-doc --> <!--
* end-user-doc -->
* @see #getConnection()
* @generated
* @ordered
*/
protected Connection connection;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
protected ConnectionItemImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PropertiesPackage.Literals.CONNECTION_ITEM;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public Connection getConnection() {
if (connection != null && connection.eIsProxy()) {
InternalEObject oldConnection = (InternalEObject)connection;
connection = (Connection)eResolveProxy(oldConnection);
if (connection != oldConnection) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, PropertiesPackage.CONNECTION_ITEM__CONNECTION, oldConnection, connection));
}
}
return connection;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public Connection basicGetConnection() {
return connection;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setConnection(Connection newConnection) {
Connection oldConnection = connection;
connection = newConnection;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PropertiesPackage.CONNECTION_ITEM__CONNECTION, oldConnection, connection));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case PropertiesPackage.CONNECTION_ITEM__CONNECTION:
if (resolve) return getConnection();
return basicGetConnection();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case PropertiesPackage.CONNECTION_ITEM__CONNECTION:
setConnection((Connection)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PropertiesPackage.CONNECTION_ITEM__CONNECTION:
setConnection((Connection)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PropertiesPackage.CONNECTION_ITEM__CONNECTION:
return connection != null;
}
return super.eIsSet(featureID);
}
} // ConnectionItemImpl