blob: b30f95651bfe242d8c8ae772f2d18cf361b6faa3 [file] [log] [blame]
/**
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* 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:
* Christophe Loetz (Loetz GmbH&Co.KG) - Initial implementation
*
*/
package org.eclipse.osbp.xtext.entitymock.impl;
import java.util.Collection;
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.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.osbp.xtext.entitymock.EntityMockDSLPackage;
import org.eclipse.osbp.xtext.entitymock.EntityMockObjectFunction;
import org.eclipse.osbp.xtext.entitymock.EntityMockObjectFunctionParameter;
import org.eclipse.xtext.common.types.JvmTypeReference;
import org.eclipse.xtext.xbase.XExpression;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Entity Mock Object Function</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.entitymock.impl.EntityMockObjectFunctionImpl#getOftype <em>Oftype</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.entitymock.impl.EntityMockObjectFunctionImpl#getParams <em>Params</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.entitymock.impl.EntityMockObjectFunctionImpl#getBody <em>Body</em>}</li>
* </ul>
*
* @generated
*/
public class EntityMockObjectFunctionImpl extends IEntityMockObjectAttributeImpl implements EntityMockObjectFunction {
/**
* The cached value of the '{@link #getOftype() <em>Oftype</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOftype()
* @generated
* @ordered
*/
protected JvmTypeReference oftype;
/**
* The cached value of the '{@link #getParams() <em>Params</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getParams()
* @generated
* @ordered
*/
protected EList<EntityMockObjectFunctionParameter> params;
/**
* The cached value of the '{@link #getBody() <em>Body</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBody()
* @generated
* @ordered
*/
protected XExpression body;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EntityMockObjectFunctionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return EntityMockDSLPackage.Literals.ENTITY_MOCK_OBJECT_FUNCTION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public JvmTypeReference getOftype() {
return oftype;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOftype(JvmTypeReference newOftype, NotificationChain msgs) {
JvmTypeReference oldOftype = oftype;
oftype = newOftype;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__OFTYPE, oldOftype, newOftype);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOftype(JvmTypeReference newOftype) {
if (newOftype != oftype) {
NotificationChain msgs = null;
if (oftype != null)
msgs = ((InternalEObject)oftype).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__OFTYPE, null, msgs);
if (newOftype != null)
msgs = ((InternalEObject)newOftype).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__OFTYPE, null, msgs);
msgs = basicSetOftype(newOftype, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__OFTYPE, newOftype, newOftype));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<EntityMockObjectFunctionParameter> getParams() {
if (params == null) {
params = new EObjectContainmentEList<EntityMockObjectFunctionParameter>(EntityMockObjectFunctionParameter.class, this, EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__PARAMS);
}
return params;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public XExpression getBody() {
return body;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetBody(XExpression newBody, NotificationChain msgs) {
XExpression oldBody = body;
body = newBody;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__BODY, oldBody, newBody);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBody(XExpression newBody) {
if (newBody != body) {
NotificationChain msgs = null;
if (body != null)
msgs = ((InternalEObject)body).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__BODY, null, msgs);
if (newBody != null)
msgs = ((InternalEObject)newBody).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__BODY, null, msgs);
msgs = basicSetBody(newBody, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__BODY, newBody, newBody));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__OFTYPE:
return basicSetOftype(null, msgs);
case EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__PARAMS:
return ((InternalEList<?>)getParams()).basicRemove(otherEnd, msgs);
case EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__BODY:
return basicSetBody(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 EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__OFTYPE:
return getOftype();
case EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__PARAMS:
return getParams();
case EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__BODY:
return getBody();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__OFTYPE:
setOftype((JvmTypeReference)newValue);
return;
case EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__PARAMS:
getParams().clear();
getParams().addAll((Collection<? extends EntityMockObjectFunctionParameter>)newValue);
return;
case EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__BODY:
setBody((XExpression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__OFTYPE:
setOftype((JvmTypeReference)null);
return;
case EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__PARAMS:
getParams().clear();
return;
case EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__BODY:
setBody((XExpression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__OFTYPE:
return oftype != null;
case EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__PARAMS:
return params != null && !params.isEmpty();
case EntityMockDSLPackage.ENTITY_MOCK_OBJECT_FUNCTION__BODY:
return body != null;
}
return super.eIsSet(featureID);
}
} //EntityMockObjectFunctionImpl