blob: 6c5f78d242720f33893336d1d6306ce493d1fbae [file] [log] [blame]
/**
* 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.DataInterchangeBlobMapping;
import org.eclipse.osbp.xtext.datainterchange.PredefinedBlobMimeTypeEnum;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Data Interchange Blob Mapping</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeBlobMappingImpl#getProperty <em>Property</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeBlobMappingImpl#getData <em>Data</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeBlobMappingImpl#getBlobFileExtension <em>Blob File Extension</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeBlobMappingImpl#getBlobPath <em>Blob Path</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datainterchange.impl.DataInterchangeBlobMappingImpl#getMimeType <em>Mime Type</em>}</li>
* </ul>
*
* @generated
*/
public class DataInterchangeBlobMappingImpl extends DataInterchangeLazyResolverImpl implements DataInterchangeBlobMapping {
/**
* The cached value of the '{@link #getProperty() <em>Property</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getProperty()
* @generated
* @ordered
*/
protected LEntityAttribute property;
/**
* The default value of the '{@link #getData() <em>Data</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getData()
* @generated
* @ordered
*/
protected static final String DATA_EDEFAULT = null;
/**
* The cached value of the '{@link #getData() <em>Data</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getData()
* @generated
* @ordered
*/
protected String data = DATA_EDEFAULT;
/**
* The default value of the '{@link #getBlobFileExtension() <em>Blob File Extension</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBlobFileExtension()
* @generated
* @ordered
*/
protected static final String BLOB_FILE_EXTENSION_EDEFAULT = null;
/**
* The cached value of the '{@link #getBlobFileExtension() <em>Blob File Extension</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBlobFileExtension()
* @generated
* @ordered
*/
protected String blobFileExtension = BLOB_FILE_EXTENSION_EDEFAULT;
/**
* The default value of the '{@link #getBlobPath() <em>Blob Path</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBlobPath()
* @generated
* @ordered
*/
protected static final String BLOB_PATH_EDEFAULT = null;
/**
* The cached value of the '{@link #getBlobPath() <em>Blob Path</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBlobPath()
* @generated
* @ordered
*/
protected String blobPath = BLOB_PATH_EDEFAULT;
/**
* The default value of the '{@link #getMimeType() <em>Mime Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMimeType()
* @generated
* @ordered
*/
protected static final PredefinedBlobMimeTypeEnum MIME_TYPE_EDEFAULT = PredefinedBlobMimeTypeEnum.PLAIN;
/**
* The cached value of the '{@link #getMimeType() <em>Mime Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMimeType()
* @generated
* @ordered
*/
protected PredefinedBlobMimeTypeEnum mimeType = MIME_TYPE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DataInterchangeBlobMappingImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DataDSLPackage.Literals.DATA_INTERCHANGE_BLOB_MAPPING;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LEntityAttribute getProperty() {
if (property != null && property.eIsProxy()) {
InternalEObject oldProperty = (InternalEObject)property;
property = (LEntityAttribute)eResolveProxy(oldProperty);
if (property != oldProperty) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__PROPERTY, oldProperty, property));
}
}
return property;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LEntityAttribute basicGetProperty() {
return property;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setProperty(LEntityAttribute newProperty) {
LEntityAttribute oldProperty = property;
property = newProperty;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__PROPERTY, oldProperty, property));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getData() {
return data;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setData(String newData) {
String oldData = data;
data = newData;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__DATA, oldData, data));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getBlobFileExtension() {
return blobFileExtension;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBlobFileExtension(String newBlobFileExtension) {
String oldBlobFileExtension = blobFileExtension;
blobFileExtension = newBlobFileExtension;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__BLOB_FILE_EXTENSION, oldBlobFileExtension, blobFileExtension));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getBlobPath() {
return blobPath;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBlobPath(String newBlobPath) {
String oldBlobPath = blobPath;
blobPath = newBlobPath;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__BLOB_PATH, oldBlobPath, blobPath));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PredefinedBlobMimeTypeEnum getMimeType() {
return mimeType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMimeType(PredefinedBlobMimeTypeEnum newMimeType) {
PredefinedBlobMimeTypeEnum oldMimeType = mimeType;
mimeType = newMimeType == null ? MIME_TYPE_EDEFAULT : newMimeType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__MIME_TYPE, oldMimeType, mimeType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__PROPERTY:
if (resolve) return getProperty();
return basicGetProperty();
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__DATA:
return getData();
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__BLOB_FILE_EXTENSION:
return getBlobFileExtension();
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__BLOB_PATH:
return getBlobPath();
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__MIME_TYPE:
return getMimeType();
}
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_BLOB_MAPPING__PROPERTY:
setProperty((LEntityAttribute)newValue);
return;
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__DATA:
setData((String)newValue);
return;
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__BLOB_FILE_EXTENSION:
setBlobFileExtension((String)newValue);
return;
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__BLOB_PATH:
setBlobPath((String)newValue);
return;
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__MIME_TYPE:
setMimeType((PredefinedBlobMimeTypeEnum)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_BLOB_MAPPING__PROPERTY:
setProperty((LEntityAttribute)null);
return;
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__DATA:
setData(DATA_EDEFAULT);
return;
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__BLOB_FILE_EXTENSION:
setBlobFileExtension(BLOB_FILE_EXTENSION_EDEFAULT);
return;
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__BLOB_PATH:
setBlobPath(BLOB_PATH_EDEFAULT);
return;
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__MIME_TYPE:
setMimeType(MIME_TYPE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__PROPERTY:
return property != null;
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__DATA:
return DATA_EDEFAULT == null ? data != null : !DATA_EDEFAULT.equals(data);
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__BLOB_FILE_EXTENSION:
return BLOB_FILE_EXTENSION_EDEFAULT == null ? blobFileExtension != null : !BLOB_FILE_EXTENSION_EDEFAULT.equals(blobFileExtension);
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__BLOB_PATH:
return BLOB_PATH_EDEFAULT == null ? blobPath != null : !BLOB_PATH_EDEFAULT.equals(blobPath);
case DataDSLPackage.DATA_INTERCHANGE_BLOB_MAPPING__MIME_TYPE:
return mimeType != MIME_TYPE_EDEFAULT;
}
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(" (data: ");
result.append(data);
result.append(", blobFileExtension: ");
result.append(blobFileExtension);
result.append(", blobPath: ");
result.append(blobPath);
result.append(", mimeType: ");
result.append(mimeType);
result.append(')');
return result.toString();
}
} //DataInterchangeBlobMappingImpl