| /** |
| * Copyright (c) 2011, 2016 - Lunifera GmbH (Wien), Loetz GmbH&Co.KG (Heidelberg) |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Based on ideas from Xtext, Xtend, Xcore |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| * |
| */ |
| package org.eclipse.osbp.dsl.semantic.service.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.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.osbp.dsl.semantic.common.types.impl.LLazyResolverImpl; |
| |
| import org.eclipse.osbp.dsl.semantic.service.LCardinality; |
| import org.eclipse.osbp.dsl.semantic.service.LInjectedService; |
| import org.eclipse.osbp.dsl.semantic.service.OSBPServicePackage; |
| |
| import org.eclipse.xtext.common.types.JvmTypeReference; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>LInjected Service</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.osbp.dsl.semantic.service.impl.LInjectedServiceImpl#getCardinality <em>Cardinality</em>}</li> |
| * <li>{@link org.eclipse.osbp.dsl.semantic.service.impl.LInjectedServiceImpl#getAttributeName <em>Attribute Name</em>}</li> |
| * <li>{@link org.eclipse.osbp.dsl.semantic.service.impl.LInjectedServiceImpl#getService <em>Service</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class LInjectedServiceImpl extends LLazyResolverImpl implements LInjectedService { |
| /** |
| * The default value of the '{@link #getCardinality() <em>Cardinality</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCardinality() |
| * @generated |
| * @ordered |
| */ |
| protected static final LCardinality CARDINALITY_EDEFAULT = LCardinality.ZERO_TO_ONE; |
| |
| /** |
| * The cached value of the '{@link #getCardinality() <em>Cardinality</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCardinality() |
| * @generated |
| * @ordered |
| */ |
| protected LCardinality cardinality = CARDINALITY_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getAttributeName() <em>Attribute Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAttributeName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String ATTRIBUTE_NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getAttributeName() <em>Attribute Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAttributeName() |
| * @generated |
| * @ordered |
| */ |
| protected String attributeName = ATTRIBUTE_NAME_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getService() <em>Service</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getService() |
| * @generated |
| * @ordered |
| */ |
| protected JvmTypeReference service; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected LInjectedServiceImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return OSBPServicePackage.Literals.LINJECTED_SERVICE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public LCardinality getCardinality() { |
| return cardinality; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setCardinality(LCardinality newCardinality) { |
| LCardinality oldCardinality = cardinality; |
| cardinality = newCardinality == null ? CARDINALITY_EDEFAULT : newCardinality; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, OSBPServicePackage.LINJECTED_SERVICE__CARDINALITY, oldCardinality, cardinality)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getAttributeName() { |
| return attributeName; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setAttributeName(String newAttributeName) { |
| String oldAttributeName = attributeName; |
| attributeName = newAttributeName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, OSBPServicePackage.LINJECTED_SERVICE__ATTRIBUTE_NAME, oldAttributeName, attributeName)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public JvmTypeReference getService() { |
| return service; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetService(JvmTypeReference newService, NotificationChain msgs) { |
| JvmTypeReference oldService = service; |
| service = newService; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OSBPServicePackage.LINJECTED_SERVICE__SERVICE, oldService, newService); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setService(JvmTypeReference newService) { |
| if (newService != service) { |
| NotificationChain msgs = null; |
| if (service != null) |
| msgs = ((InternalEObject)service).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OSBPServicePackage.LINJECTED_SERVICE__SERVICE, null, msgs); |
| if (newService != null) |
| msgs = ((InternalEObject)newService).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OSBPServicePackage.LINJECTED_SERVICE__SERVICE, null, msgs); |
| msgs = basicSetService(newService, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, OSBPServicePackage.LINJECTED_SERVICE__SERVICE, newService, newService)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case OSBPServicePackage.LINJECTED_SERVICE__SERVICE: |
| return basicSetService(null, 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 OSBPServicePackage.LINJECTED_SERVICE__CARDINALITY: |
| return getCardinality(); |
| case OSBPServicePackage.LINJECTED_SERVICE__ATTRIBUTE_NAME: |
| return getAttributeName(); |
| case OSBPServicePackage.LINJECTED_SERVICE__SERVICE: |
| return getService(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case OSBPServicePackage.LINJECTED_SERVICE__CARDINALITY: |
| setCardinality((LCardinality)newValue); |
| return; |
| case OSBPServicePackage.LINJECTED_SERVICE__ATTRIBUTE_NAME: |
| setAttributeName((String)newValue); |
| return; |
| case OSBPServicePackage.LINJECTED_SERVICE__SERVICE: |
| setService((JvmTypeReference)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case OSBPServicePackage.LINJECTED_SERVICE__CARDINALITY: |
| setCardinality(CARDINALITY_EDEFAULT); |
| return; |
| case OSBPServicePackage.LINJECTED_SERVICE__ATTRIBUTE_NAME: |
| setAttributeName(ATTRIBUTE_NAME_EDEFAULT); |
| return; |
| case OSBPServicePackage.LINJECTED_SERVICE__SERVICE: |
| setService((JvmTypeReference)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case OSBPServicePackage.LINJECTED_SERVICE__CARDINALITY: |
| return cardinality != CARDINALITY_EDEFAULT; |
| case OSBPServicePackage.LINJECTED_SERVICE__ATTRIBUTE_NAME: |
| return ATTRIBUTE_NAME_EDEFAULT == null ? attributeName != null : !ATTRIBUTE_NAME_EDEFAULT.equals(attributeName); |
| case OSBPServicePackage.LINJECTED_SERVICE__SERVICE: |
| return service != null; |
| } |
| 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(" (cardinality: "); |
| result.append(cardinality); |
| result.append(", attributeName: "); |
| result.append(attributeName); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //LInjectedServiceImpl |