/* * JBoss, Home of Professional Open Source. * * See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing. * * See the AUTHORS.txt file distributed with this work for a full listing of individual contributors. */ package org.teiid.designer.metamodels.function.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.EStructuralFeature; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.EObjectImpl; import org.eclipse.emf.ecore.util.EcoreUtil; import org.teiid.designer.metamodels.function.FunctionPackage; import org.teiid.designer.metamodels.function.ReturnParameter; import org.teiid.designer.metamodels.function.ScalarFunction; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Return Parameter</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.teiid.designer.metamodels.function.impl.ReturnParameterImpl#getFunction <em>Function</em>}</li> * <li>{@link org.teiid.designer.metamodels.function.impl.ReturnParameterImpl#getType <em>Type</em>}</li> * </ul> * </p> * * @generated * * @since 8.0 */ public class ReturnParameterImpl extends EObjectImpl implements ReturnParameter { /** * The default value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected static final String TYPE_EDEFAULT = null; /** * The cached value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected String type = TYPE_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ReturnParameterImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return FunctionPackage.eINSTANCE.getReturnParameter(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getType() { return type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setType(String newType) { String oldType = type; type = newType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FunctionPackage.RETURN_PARAMETER__TYPE, oldType, type)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public ScalarFunction getFunction() { if (eContainerFeatureID != FunctionPackage.RETURN_PARAMETER__FUNCTION) return null; return (ScalarFunction)eContainer; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setFunction(ScalarFunction newFunction) { if (newFunction != eContainer || (eContainerFeatureID != FunctionPackage.RETURN_PARAMETER__FUNCTION && newFunction != null)) { if (EcoreUtil.isAncestor(this, newFunction)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); //$NON-NLS-1$ NotificationChain msgs = null; if (eContainer != null) msgs = eBasicRemoveFromContainer(msgs); if (newFunction != null) msgs = ((InternalEObject)newFunction).eInverseAdd(this, FunctionPackage.SCALAR_FUNCTION__RETURN_PARAMETER, ScalarFunction.class, msgs); msgs = eBasicSetContainer((InternalEObject)newFunction, FunctionPackage.RETURN_PARAMETER__FUNCTION, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FunctionPackage.RETURN_PARAMETER__FUNCTION, newFunction, newFunction)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { if (featureID >= 0) { switch (eDerivedStructuralFeatureID(featureID, baseClass)) { case FunctionPackage.RETURN_PARAMETER__FUNCTION: if (eContainer != null) msgs = eBasicRemoveFromContainer(msgs); return eBasicSetContainer(otherEnd, FunctionPackage.RETURN_PARAMETER__FUNCTION, msgs); default: return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); } } if (eContainer != null) msgs = eBasicRemoveFromContainer(msgs); return eBasicSetContainer(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { if (featureID >= 0) { switch (eDerivedStructuralFeatureID(featureID, baseClass)) { case FunctionPackage.RETURN_PARAMETER__FUNCTION: return eBasicSetContainer(null, FunctionPackage.RETURN_PARAMETER__FUNCTION, msgs); default: return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); } } return eBasicSetContainer(null, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) { if (eContainerFeatureID >= 0) { switch (eContainerFeatureID) { case FunctionPackage.RETURN_PARAMETER__FUNCTION: return eContainer.eInverseRemove(this, FunctionPackage.SCALAR_FUNCTION__RETURN_PARAMETER, ScalarFunction.class, msgs); default: return eDynamicBasicRemoveFromContainer(msgs); } } return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(EStructuralFeature eFeature, boolean resolve) { switch (eDerivedStructuralFeatureID(eFeature)) { case FunctionPackage.RETURN_PARAMETER__FUNCTION: return getFunction(); case FunctionPackage.RETURN_PARAMETER__TYPE: return getType(); } return eDynamicGet(eFeature, resolve); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(EStructuralFeature eFeature, Object newValue) { switch (eDerivedStructuralFeatureID(eFeature)) { case FunctionPackage.RETURN_PARAMETER__FUNCTION: setFunction((ScalarFunction)newValue); return; case FunctionPackage.RETURN_PARAMETER__TYPE: setType((String)newValue); return; } eDynamicSet(eFeature, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(EStructuralFeature eFeature) { switch (eDerivedStructuralFeatureID(eFeature)) { case FunctionPackage.RETURN_PARAMETER__FUNCTION: setFunction((ScalarFunction)null); return; case FunctionPackage.RETURN_PARAMETER__TYPE: setType(TYPE_EDEFAULT); return; } eDynamicUnset(eFeature); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(EStructuralFeature eFeature) { switch (eDerivedStructuralFeatureID(eFeature)) { case FunctionPackage.RETURN_PARAMETER__FUNCTION: return getFunction() != null; case FunctionPackage.RETURN_PARAMETER__TYPE: return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type); } return eDynamicIsSet(eFeature); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (type: "); //$NON-NLS-1$ result.append(type); result.append(')'); return result.toString(); } } //ReturnParameterImpl