| /** |
| * Copyright (c) 2014, 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 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Based on ideas from Xtext, Xtend, Xcore |
| * |
| * Contributors: |
| * Joerg Riegel - Initial implementation |
| * |
| */ |
| package org.eclipse.osbp.xtext.datainterchange.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.eclipse.osbp.dsl.semantic.entity.LEntityAttribute; |
| |
| import org.eclipse.osbp.xtext.datainterchange.DataDSLPackage; |
| import org.eclipse.osbp.xtext.datainterchange.DataInterchangeFormat; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Data Interchange Format</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeFormatImpl#getTargetProperty <em>Target Property</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeFormatImpl#getFormat <em>Format</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class DataInterchangeFormatImpl extends DataInterchangeLazyResolverImpl implements DataInterchangeFormat { |
| /** |
| * The cached value of the '{@link #getTargetProperty() <em>Target Property</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTargetProperty() |
| * @generated |
| * @ordered |
| */ |
| protected LEntityAttribute targetProperty; |
| |
| /** |
| * The default value of the '{@link #getFormat() <em>Format</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFormat() |
| * @generated |
| * @ordered |
| */ |
| protected static final String FORMAT_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getFormat() <em>Format</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFormat() |
| * @generated |
| * @ordered |
| */ |
| protected String format = FORMAT_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected DataInterchangeFormatImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return DataDSLPackage.Literals.DATA_INTERCHANGE_FORMAT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public LEntityAttribute getTargetProperty() { |
| if (targetProperty != null && targetProperty.eIsProxy()) { |
| InternalEObject oldTargetProperty = (InternalEObject)targetProperty; |
| targetProperty = (LEntityAttribute)eResolveProxy(oldTargetProperty); |
| if (targetProperty != oldTargetProperty) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, DataDSLPackage.DATA_INTERCHANGE_FORMAT__TARGET_PROPERTY, oldTargetProperty, targetProperty)); |
| } |
| } |
| return targetProperty; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public LEntityAttribute basicGetTargetProperty() { |
| return targetProperty; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setTargetProperty(LEntityAttribute newTargetProperty) { |
| LEntityAttribute oldTargetProperty = targetProperty; |
| targetProperty = newTargetProperty; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_FORMAT__TARGET_PROPERTY, oldTargetProperty, targetProperty)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getFormat() { |
| return format; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setFormat(String newFormat) { |
| String oldFormat = format; |
| format = newFormat; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_FORMAT__FORMAT, oldFormat, format)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case DataDSLPackage.DATA_INTERCHANGE_FORMAT__TARGET_PROPERTY: |
| if (resolve) return getTargetProperty(); |
| return basicGetTargetProperty(); |
| case DataDSLPackage.DATA_INTERCHANGE_FORMAT__FORMAT: |
| return getFormat(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case DataDSLPackage.DATA_INTERCHANGE_FORMAT__TARGET_PROPERTY: |
| setTargetProperty((LEntityAttribute)newValue); |
| return; |
| case DataDSLPackage.DATA_INTERCHANGE_FORMAT__FORMAT: |
| setFormat((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case DataDSLPackage.DATA_INTERCHANGE_FORMAT__TARGET_PROPERTY: |
| setTargetProperty((LEntityAttribute)null); |
| return; |
| case DataDSLPackage.DATA_INTERCHANGE_FORMAT__FORMAT: |
| setFormat(FORMAT_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case DataDSLPackage.DATA_INTERCHANGE_FORMAT__TARGET_PROPERTY: |
| return targetProperty != null; |
| case DataDSLPackage.DATA_INTERCHANGE_FORMAT__FORMAT: |
| return FORMAT_EDEFAULT == null ? format != null : !FORMAT_EDEFAULT.equals(format); |
| } |
| 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(" (format: "); |
| result.append(format); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //DataInterchangeFormatImpl |