org.contextmapper.tactic.dsl.tacticdsl.impl.ServiceImpl Maven / Gradle / Ivy
/**
* generated by Xtext 2.20.0
*/
package org.contextmapper.tactic.dsl.tacticdsl.impl;
import java.util.Collection;
import org.contextmapper.tactic.dsl.tacticdsl.Service;
import org.contextmapper.tactic.dsl.tacticdsl.ServiceOperation;
import org.contextmapper.tactic.dsl.tacticdsl.TacticdslPackage;
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;
/**
*
* An implementation of the model object 'Service'.
*
*
* The following features are implemented:
*
*
* - {@link org.contextmapper.tactic.dsl.tacticdsl.impl.ServiceImpl#getComment Comment}
* - {@link org.contextmapper.tactic.dsl.tacticdsl.impl.ServiceImpl#isWebService Web Service}
* - {@link org.contextmapper.tactic.dsl.tacticdsl.impl.ServiceImpl#getOperations Operations}
*
*
* @generated
*/
public class ServiceImpl extends ServiceRepositoryOptionImpl implements Service
{
/**
* The default value of the '{@link #getComment() Comment}' attribute.
*
*
* @see #getComment()
* @generated
* @ordered
*/
protected static final String COMMENT_EDEFAULT = null;
/**
* The cached value of the '{@link #getComment() Comment}' attribute.
*
*
* @see #getComment()
* @generated
* @ordered
*/
protected String comment = COMMENT_EDEFAULT;
/**
* The default value of the '{@link #isWebService() Web Service}' attribute.
*
*
* @see #isWebService()
* @generated
* @ordered
*/
protected static final boolean WEB_SERVICE_EDEFAULT = false;
/**
* The cached value of the '{@link #isWebService() Web Service}' attribute.
*
*
* @see #isWebService()
* @generated
* @ordered
*/
protected boolean webService = WEB_SERVICE_EDEFAULT;
/**
* The cached value of the '{@link #getOperations() Operations}' containment reference list.
*
*
* @see #getOperations()
* @generated
* @ordered
*/
protected EList operations;
/**
*
*
* @generated
*/
protected ServiceImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return TacticdslPackage.Literals.SERVICE;
}
/**
*
*
* @generated
*/
public String getComment()
{
return comment;
}
/**
*
*
* @generated
*/
public void setComment(String newComment)
{
String oldComment = comment;
comment = newComment;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TacticdslPackage.SERVICE__COMMENT, oldComment, comment));
}
/**
*
*
* @generated
*/
public boolean isWebService()
{
return webService;
}
/**
*
*
* @generated
*/
public void setWebService(boolean newWebService)
{
boolean oldWebService = webService;
webService = newWebService;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TacticdslPackage.SERVICE__WEB_SERVICE, oldWebService, webService));
}
/**
*
*
* @generated
*/
public EList getOperations()
{
if (operations == null)
{
operations = new EObjectContainmentEList(ServiceOperation.class, this, TacticdslPackage.SERVICE__OPERATIONS);
}
return operations;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case TacticdslPackage.SERVICE__OPERATIONS:
return ((InternalEList>)getOperations()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case TacticdslPackage.SERVICE__COMMENT:
return getComment();
case TacticdslPackage.SERVICE__WEB_SERVICE:
return isWebService();
case TacticdslPackage.SERVICE__OPERATIONS:
return getOperations();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case TacticdslPackage.SERVICE__COMMENT:
setComment((String)newValue);
return;
case TacticdslPackage.SERVICE__WEB_SERVICE:
setWebService((Boolean)newValue);
return;
case TacticdslPackage.SERVICE__OPERATIONS:
getOperations().clear();
getOperations().addAll((Collection extends ServiceOperation>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case TacticdslPackage.SERVICE__COMMENT:
setComment(COMMENT_EDEFAULT);
return;
case TacticdslPackage.SERVICE__WEB_SERVICE:
setWebService(WEB_SERVICE_EDEFAULT);
return;
case TacticdslPackage.SERVICE__OPERATIONS:
getOperations().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case TacticdslPackage.SERVICE__COMMENT:
return COMMENT_EDEFAULT == null ? comment != null : !COMMENT_EDEFAULT.equals(comment);
case TacticdslPackage.SERVICE__WEB_SERVICE:
return webService != WEB_SERVICE_EDEFAULT;
case TacticdslPackage.SERVICE__OPERATIONS:
return operations != null && !operations.isEmpty();
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (comment: ");
result.append(comment);
result.append(", webService: ");
result.append(webService);
result.append(')');
return result.toString();
}
} //ServiceImpl