| /**
|
| * *******************************************************************************
|
| * Copyright (c) 2009, 2019 Mia-Software and others.
|
| * All rights reserved. This program and the accompanying materials
|
| * are made available under the terms of the Eclipse Public License v2.0
|
| * which accompanies this distribution, and is available at
|
| * http://www.eclipse.org/legal/epl-v20.html
|
| *
|
| * Contributors:
|
| *
|
| * Fabien Giquel (Mia-Software) - initial API and implementation
|
| * *******************************************************************************
|
| *
|
| * $Id$
|
| */ |
| package org.eclipse.modisco.java.emf.classic.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.EObjectContainmentEList;
|
| import org.eclipse.emf.ecore.util.InternalEList;
|
| import org.eclipse.modisco.java.AbstractMethodDeclaration;
|
| import org.eclipse.modisco.java.MethodRef;
|
| import org.eclipse.modisco.java.MethodRefParameter;
|
| import org.eclipse.modisco.java.TypeAccess;
|
| import org.eclipse.modisco.java.emf.classic.JavaPackage;
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * An implementation of the model object '<em><b>Method Ref</b></em>'.
|
| * <!-- end-user-doc -->
|
| * <p>
|
| * The following features are implemented:
|
| * <ul>
|
| * <li>{@link org.eclipse.modisco.java.emf.classic.impl.MethodRefImpl#getMethod <em>Method</em>}</li>
|
| * <li>{@link org.eclipse.modisco.java.emf.classic.impl.MethodRefImpl#getQualifier <em>Qualifier</em>}</li>
|
| * <li>{@link org.eclipse.modisco.java.emf.classic.impl.MethodRefImpl#getParameters <em>Parameters</em>}</li>
|
| * </ul>
|
| * </p>
|
| *
|
| * @generated
|
| */
|
| public class MethodRefImpl extends ASTNodeImpl implements MethodRef {
|
| /**
|
| * The cached value of the '{@link #getMethod() <em>Method</em>}' reference.
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @see #getMethod()
|
| * @generated
|
| * @ordered
|
| */
|
| protected AbstractMethodDeclaration method;
|
|
|
| /**
|
| * The cached value of the '{@link #getQualifier() <em>Qualifier</em>}' containment reference.
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @see #getQualifier()
|
| * @generated
|
| * @ordered
|
| */
|
| protected TypeAccess qualifier;
|
|
|
| /**
|
| * The cached value of the '{@link #getParameters() <em>Parameters</em>}' containment reference list.
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @see #getParameters()
|
| * @generated
|
| * @ordered
|
| */
|
| protected EList<MethodRefParameter> parameters;
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| protected MethodRefImpl() {
|
| super();
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| protected EClass eStaticClass() {
|
| return JavaPackage.eINSTANCE.getMethodRef();
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public AbstractMethodDeclaration getMethod() {
|
| if (method != null && method.eIsProxy()) {
|
| InternalEObject oldMethod = (InternalEObject)method;
|
| method = (AbstractMethodDeclaration)eResolveProxy(oldMethod);
|
| if (method != oldMethod) {
|
| if (eNotificationRequired())
|
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, JavaPackage.METHOD_REF__METHOD, oldMethod, method));
|
| }
|
| }
|
| return method;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public AbstractMethodDeclaration basicGetMethod() {
|
| return method;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public NotificationChain basicSetMethod(AbstractMethodDeclaration newMethod, NotificationChain msgs) {
|
| AbstractMethodDeclaration oldMethod = method;
|
| method = newMethod;
|
| if (eNotificationRequired()) {
|
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaPackage.METHOD_REF__METHOD, oldMethod, newMethod);
|
| if (msgs == null) msgs = notification; else msgs.add(notification);
|
| }
|
| return msgs;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public void setMethod(AbstractMethodDeclaration newMethod) {
|
| if (newMethod != method) {
|
| NotificationChain msgs = null;
|
| if (method != null)
|
| msgs = ((InternalEObject)method).eInverseRemove(this, JavaPackage.ABSTRACT_METHOD_DECLARATION__USAGES_IN_DOC_COMMENTS, AbstractMethodDeclaration.class, msgs);
|
| if (newMethod != null)
|
| msgs = ((InternalEObject)newMethod).eInverseAdd(this, JavaPackage.ABSTRACT_METHOD_DECLARATION__USAGES_IN_DOC_COMMENTS, AbstractMethodDeclaration.class, msgs);
|
| msgs = basicSetMethod(newMethod, msgs);
|
| if (msgs != null) msgs.dispatch();
|
| }
|
| else if (eNotificationRequired())
|
| eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.METHOD_REF__METHOD, newMethod, newMethod));
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public TypeAccess getQualifier() {
|
| return qualifier;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public NotificationChain basicSetQualifier(TypeAccess newQualifier, NotificationChain msgs) {
|
| TypeAccess oldQualifier = qualifier;
|
| qualifier = newQualifier;
|
| if (eNotificationRequired()) {
|
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaPackage.METHOD_REF__QUALIFIER, oldQualifier, newQualifier);
|
| if (msgs == null) msgs = notification; else msgs.add(notification);
|
| }
|
| return msgs;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public void setQualifier(TypeAccess newQualifier) {
|
| if (newQualifier != qualifier) {
|
| NotificationChain msgs = null;
|
| if (qualifier != null)
|
| msgs = ((InternalEObject)qualifier).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JavaPackage.METHOD_REF__QUALIFIER, null, msgs);
|
| if (newQualifier != null)
|
| msgs = ((InternalEObject)newQualifier).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JavaPackage.METHOD_REF__QUALIFIER, null, msgs);
|
| msgs = basicSetQualifier(newQualifier, msgs);
|
| if (msgs != null) msgs.dispatch();
|
| }
|
| else if (eNotificationRequired())
|
| eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.METHOD_REF__QUALIFIER, newQualifier, newQualifier));
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public EList<MethodRefParameter> getParameters() {
|
| if (parameters == null) {
|
| parameters = new EObjectContainmentEList<MethodRefParameter>(MethodRefParameter.class, this, JavaPackage.METHOD_REF__PARAMETERS);
|
| }
|
| return parameters;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
|
| switch (featureID) {
|
| case JavaPackage.METHOD_REF__METHOD:
|
| if (method != null)
|
| msgs = ((InternalEObject)method).eInverseRemove(this, JavaPackage.ABSTRACT_METHOD_DECLARATION__USAGES_IN_DOC_COMMENTS, AbstractMethodDeclaration.class, msgs);
|
| return basicSetMethod((AbstractMethodDeclaration)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 JavaPackage.METHOD_REF__METHOD:
|
| return basicSetMethod(null, msgs);
|
| case JavaPackage.METHOD_REF__QUALIFIER:
|
| return basicSetQualifier(null, msgs);
|
| case JavaPackage.METHOD_REF__PARAMETERS:
|
| return ((InternalEList<?>)getParameters()).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 JavaPackage.METHOD_REF__METHOD:
|
| if (resolve) return getMethod();
|
| return basicGetMethod();
|
| case JavaPackage.METHOD_REF__QUALIFIER:
|
| return getQualifier();
|
| case JavaPackage.METHOD_REF__PARAMETERS:
|
| return getParameters();
|
| }
|
| 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 JavaPackage.METHOD_REF__METHOD:
|
| setMethod((AbstractMethodDeclaration)newValue);
|
| return;
|
| case JavaPackage.METHOD_REF__QUALIFIER:
|
| setQualifier((TypeAccess)newValue);
|
| return;
|
| case JavaPackage.METHOD_REF__PARAMETERS:
|
| getParameters().clear();
|
| getParameters().addAll((Collection<? extends MethodRefParameter>)newValue);
|
| return;
|
| }
|
| super.eSet(featureID, newValue);
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public void eUnset(int featureID) {
|
| switch (featureID) {
|
| case JavaPackage.METHOD_REF__METHOD:
|
| setMethod((AbstractMethodDeclaration)null);
|
| return;
|
| case JavaPackage.METHOD_REF__QUALIFIER:
|
| setQualifier((TypeAccess)null);
|
| return;
|
| case JavaPackage.METHOD_REF__PARAMETERS:
|
| getParameters().clear();
|
| return;
|
| }
|
| super.eUnset(featureID);
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public boolean eIsSet(int featureID) {
|
| switch (featureID) {
|
| case JavaPackage.METHOD_REF__METHOD:
|
| return method != null;
|
| case JavaPackage.METHOD_REF__QUALIFIER:
|
| return qualifier != null;
|
| case JavaPackage.METHOD_REF__PARAMETERS:
|
| return parameters != null && !parameters.isEmpty();
|
| }
|
| return super.eIsSet(featureID);
|
| }
|
|
|
| } //MethodRefImpl
|