blob: 1abe1a16d59deb15978120769da973ff567c6d98 [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 v1.0
* which accompanies this distribution, and is available at
* http{//www.eclipse.org/legal/epl-v10.html
*
* Based on ideas from Xtext, Xtend, Xcore
*
* Contributors:
* Loetz GmbH&Co.KG - Initial implementation
*
*/
package org.eclipse.osbp.xtext.blip.impl;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.osbp.dsl.semantic.dto.LDto;
import org.eclipse.osbp.xtext.blip.BlipDSLPackage;
import org.eclipse.osbp.xtext.blip.BlipDtoPath;
import org.eclipse.osbp.xtext.blip.BlipItem;
import org.eclipse.osbp.xtext.blip.common.BlipHelper;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Blip Item</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.blip.impl.BlipItemImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.blip.impl.BlipItemImpl#getDtoPath <em>Dto Path</em>}</li>
* </ul>
*
* @generated
*/
public class BlipItemImpl extends MinimalEObjectImpl.Container implements BlipItem {
/**
* 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 #getDtoPath() <em>Dto Path</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDtoPath()
* @generated
* @ordered
*/
protected BlipDtoPath dtoPath;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected BlipItemImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return BlipDSLPackage.Literals.BLIP_ITEM;
}
/**
* <!-- 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, BlipDSLPackage.BLIP_ITEM__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BlipDtoPath getDtoPath() {
return dtoPath;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetDtoPath(BlipDtoPath newDtoPath, NotificationChain msgs) {
BlipDtoPath oldDtoPath = dtoPath;
dtoPath = newDtoPath;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, BlipDSLPackage.BLIP_ITEM__DTO_PATH, oldDtoPath, newDtoPath);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDtoPath(BlipDtoPath newDtoPath) {
if (newDtoPath != dtoPath) {
NotificationChain msgs = null;
if (dtoPath != null)
msgs = ((InternalEObject)dtoPath).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - BlipDSLPackage.BLIP_ITEM__DTO_PATH, null, msgs);
if (newDtoPath != null)
msgs = ((InternalEObject)newDtoPath).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - BlipDSLPackage.BLIP_ITEM__DTO_PATH, null, msgs);
msgs = basicSetDtoPath(newDtoPath, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BlipDSLPackage.BLIP_ITEM__DTO_PATH, newDtoPath, newDtoPath));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LDto getOperativeLDto() {
return BlipHelper.getOperativeLDto(this);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case BlipDSLPackage.BLIP_ITEM__DTO_PATH:
return basicSetDtoPath(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case BlipDSLPackage.BLIP_ITEM__NAME:
return getName();
case BlipDSLPackage.BLIP_ITEM__DTO_PATH:
return getDtoPath();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case BlipDSLPackage.BLIP_ITEM__NAME:
setName((String)newValue);
return;
case BlipDSLPackage.BLIP_ITEM__DTO_PATH:
setDtoPath((BlipDtoPath)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case BlipDSLPackage.BLIP_ITEM__NAME:
setName(NAME_EDEFAULT);
return;
case BlipDSLPackage.BLIP_ITEM__DTO_PATH:
setDtoPath((BlipDtoPath)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case BlipDSLPackage.BLIP_ITEM__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case BlipDSLPackage.BLIP_ITEM__DTO_PATH:
return dtoPath != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
switch (operationID) {
case BlipDSLPackage.BLIP_ITEM___GET_OPERATIVE_LDTO:
return getOperativeLDto();
}
return super.eInvoke(operationID, arguments);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //BlipItemImpl