blob: 5edc1019cb7427d8b7099dc6f7650b1319fd0017 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009, 2019 Xored Software Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Xored Software Inc - initial API and implementation and/or initial documentation
*******************************************************************************/
package org.eclipse.rcptt.core.scenario.impl;
import org.eclipse.rcptt.core.scenario.Attachment;
import org.eclipse.rcptt.core.scenario.ScenarioPackage;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Attachment</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.rcptt.core.scenario.impl.AttachmentImpl#getType <em>Type</em>}</li>
* <li>{@link org.eclipse.rcptt.core.scenario.impl.AttachmentImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.rcptt.core.scenario.impl.AttachmentImpl#getData <em>Data</em>}</li>
* </ul>
*
* @generated
*/
public class AttachmentImpl extends EObjectImpl implements Attachment {
/**
* The default value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected static final String TYPE_EDEFAULT = null;
/**
* The cached value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected String type = TYPE_EDEFAULT;
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The cached value of the '{@link #getData() <em>Data</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getData()
* @generated
* @ordered
*/
protected EObject data;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AttachmentImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ScenarioPackage.Literals.ATTACHMENT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getType() {
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setType(String newType) {
String oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ScenarioPackage.ATTACHMENT__TYPE, oldType, type));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ScenarioPackage.ATTACHMENT__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EObject getData() {
if (data != null && data.eIsProxy()) {
InternalEObject oldData = (InternalEObject)data;
data = eResolveProxy(oldData);
if (data != oldData) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ScenarioPackage.ATTACHMENT__DATA, oldData, data));
}
}
return data;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EObject basicGetData() {
return data;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setData(EObject newData) {
EObject oldData = data;
data = newData;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ScenarioPackage.ATTACHMENT__DATA, oldData, data));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ScenarioPackage.ATTACHMENT__TYPE:
return getType();
case ScenarioPackage.ATTACHMENT__NAME:
return getName();
case ScenarioPackage.ATTACHMENT__DATA:
if (resolve) return getData();
return basicGetData();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ScenarioPackage.ATTACHMENT__TYPE:
setType((String)newValue);
return;
case ScenarioPackage.ATTACHMENT__NAME:
setName((String)newValue);
return;
case ScenarioPackage.ATTACHMENT__DATA:
setData((EObject)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ScenarioPackage.ATTACHMENT__TYPE:
setType(TYPE_EDEFAULT);
return;
case ScenarioPackage.ATTACHMENT__NAME:
setName(NAME_EDEFAULT);
return;
case ScenarioPackage.ATTACHMENT__DATA:
setData((EObject)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ScenarioPackage.ATTACHMENT__TYPE:
return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
case ScenarioPackage.ATTACHMENT__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case ScenarioPackage.ATTACHMENT__DATA:
return data != 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(" (type: ");
result.append(type);
result.append(", name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //AttachmentImpl