| /***************************************************************************** |
| * Copyright (c) 2020 CEA LIST. |
| * |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Saadia Dhouib (CEA LIST) saadia.dhouib@cea.fr - Initial API and implementation |
| * |
| *****************************************************************************/ |
| package org.eclipse.papyrus.aas.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.ecore.EClass; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; |
| |
| import org.eclipse.papyrus.aas.AASPackage; |
| import org.eclipse.papyrus.aas.Endpoint; |
| import org.eclipse.papyrus.aas.ProtocolKind; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Endpoint</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.aas.impl.EndpointImpl#getAddress <em>Address</em>}</li> |
| * <li>{@link org.eclipse.papyrus.aas.impl.EndpointImpl#getProtocol <em>Protocol</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class EndpointImpl extends MinimalEObjectImpl.Container implements Endpoint { |
| /** |
| * The default value of the '{@link #getAddress() <em>Address</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getAddress() |
| * @generated |
| * @ordered |
| */ |
| protected static final String ADDRESS_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getAddress() <em>Address</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getAddress() |
| * @generated |
| * @ordered |
| */ |
| protected String address = ADDRESS_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getProtocol() <em>Protocol</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getProtocol() |
| * @generated |
| * @ordered |
| */ |
| protected static final ProtocolKind PROTOCOL_EDEFAULT = ProtocolKind.HTTP; |
| |
| /** |
| * The cached value of the '{@link #getProtocol() <em>Protocol</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getProtocol() |
| * @generated |
| * @ordered |
| */ |
| protected ProtocolKind protocol = PROTOCOL_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected EndpointImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AASPackage.Literals.ENDPOINT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public String getAddress() { |
| return address; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setAddress(String newAddress) { |
| String oldAddress = address; |
| address = newAddress; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AASPackage.ENDPOINT__ADDRESS, oldAddress, address)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public ProtocolKind getProtocol() { |
| return protocol; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setProtocol(ProtocolKind newProtocol) { |
| ProtocolKind oldProtocol = protocol; |
| protocol = newProtocol == null ? PROTOCOL_EDEFAULT : newProtocol; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AASPackage.ENDPOINT__PROTOCOL, oldProtocol, protocol)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case AASPackage.ENDPOINT__ADDRESS: |
| return getAddress(); |
| case AASPackage.ENDPOINT__PROTOCOL: |
| return getProtocol(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case AASPackage.ENDPOINT__ADDRESS: |
| setAddress((String) newValue); |
| return; |
| case AASPackage.ENDPOINT__PROTOCOL: |
| setProtocol((ProtocolKind) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AASPackage.ENDPOINT__ADDRESS: |
| setAddress(ADDRESS_EDEFAULT); |
| return; |
| case AASPackage.ENDPOINT__PROTOCOL: |
| setProtocol(PROTOCOL_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AASPackage.ENDPOINT__ADDRESS: |
| return ADDRESS_EDEFAULT == null ? address != null : !ADDRESS_EDEFAULT.equals(address); |
| case AASPackage.ENDPOINT__PROTOCOL: |
| return protocol != PROTOCOL_EDEFAULT; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) |
| return super.toString(); |
| |
| StringBuilder result = new StringBuilder(super.toString()); |
| result.append(" (address: "); |
| result.append(address); |
| result.append(", protocol: "); |
| result.append(protocol); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } // EndpointImpl |