blob: c4047fcffdaf2dd91b68adbf15a34fa03e358c78 [file] [log] [blame]
/*****************************************************************************
* 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.papyrus.aas.AASPackage;
import org.eclipse.papyrus.aas.File;
import org.eclipse.papyrus.aas.MimeType;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>File</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.papyrus.aas.impl.FileImpl#getPath <em>Path</em>}</li>
* <li>{@link org.eclipse.papyrus.aas.impl.FileImpl#getMimeType <em>Mime Type</em>}</li>
* </ul>
*
* @generated
*/
public class FileImpl extends DataElementImpl implements File {
/**
* The default value of the '{@link #getPath() <em>Path</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getPath()
* @generated
* @ordered
*/
protected static final String PATH_EDEFAULT = null;
/**
* The cached value of the '{@link #getPath() <em>Path</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getPath()
* @generated
* @ordered
*/
protected String path = 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 MimeType MIME_TYPE_EDEFAULT = MimeType.APPLICATIONJSON;
/**
* The cached value of the '{@link #getMimeType() <em>Mime Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getMimeType()
* @generated
* @ordered
*/
protected MimeType mimeType = MIME_TYPE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected FileImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return AASPackage.Literals.FILE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public String getPath() {
return path;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public void setPath(String newPath) {
String oldPath = path;
path = newPath;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AASPackage.FILE__PATH, oldPath, path));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public MimeType getMimeType() {
return mimeType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public void setMimeType(MimeType newMimeType) {
MimeType oldMimeType = mimeType;
mimeType = newMimeType == null ? MIME_TYPE_EDEFAULT : newMimeType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AASPackage.FILE__MIME_TYPE, oldMimeType, mimeType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AASPackage.FILE__PATH:
return getPath();
case AASPackage.FILE__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 AASPackage.FILE__PATH:
setPath((String) newValue);
return;
case AASPackage.FILE__MIME_TYPE:
setMimeType((MimeType) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AASPackage.FILE__PATH:
setPath(PATH_EDEFAULT);
return;
case AASPackage.FILE__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 AASPackage.FILE__PATH:
return PATH_EDEFAULT == null ? path != null : !PATH_EDEFAULT.equals(path);
case AASPackage.FILE__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();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (path: ");
result.append(path);
result.append(", mimeType: ");
result.append(mimeType);
result.append(')');
return result.toString();
}
} // FileImpl