/**
*/
package org.applause.lang.applauseDsl.impl;
import org.applause.lang.applauseDsl.ApplauseDslPackage;
import org.applause.lang.applauseDsl.DataSourceBodySpecification;
import org.applause.lang.applauseDsl.RESTSpecification;
import org.applause.lang.applauseDsl.RESTURL;
import org.applause.lang.applauseDsl.RESTVerb;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>REST Specification</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.applause.lang.applauseDsl.impl.RESTSpecificationImpl#getVerb <em>Verb</em>}</li>
* <li>{@link org.applause.lang.applauseDsl.impl.RESTSpecificationImpl#getPath <em>Path</em>}</li>
* <li>{@link org.applause.lang.applauseDsl.impl.RESTSpecificationImpl#getBody <em>Body</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class RESTSpecificationImpl extends MinimalEObjectImpl.Container implements RESTSpecification
{
/**
* The default value of the '{@link #getVerb() <em>Verb</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVerb()
* @generated
* @ordered
*/
protected static final RESTVerb VERB_EDEFAULT = RESTVerb.GET;
/**
* The cached value of the '{@link #getVerb() <em>Verb</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVerb()
* @generated
* @ordered
*/
protected RESTVerb verb = VERB_EDEFAULT;
/**
* The cached value of the '{@link #getPath() <em>Path</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPath()
* @generated
* @ordered
*/
protected RESTURL path;
/**
* The cached value of the '{@link #getBody() <em>Body</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBody()
* @generated
* @ordered
*/
protected DataSourceBodySpecification body;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected RESTSpecificationImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return ApplauseDslPackage.Literals.REST_SPECIFICATION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public RESTVerb getVerb()
{
return verb;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setVerb(RESTVerb newVerb)
{
RESTVerb oldVerb = verb;
verb = newVerb == null ? VERB_EDEFAULT : newVerb;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ApplauseDslPackage.REST_SPECIFICATION__VERB, oldVerb, verb));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public RESTURL getPath()
{
return path;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetPath(RESTURL newPath, NotificationChain msgs)
{
RESTURL oldPath = path;
path = newPath;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ApplauseDslPackage.REST_SPECIFICATION__PATH, oldPath, newPath);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPath(RESTURL newPath)
{
if (newPath != path)
{
NotificationChain msgs = null;
if (path != null)
msgs = ((InternalEObject)path).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ApplauseDslPackage.REST_SPECIFICATION__PATH, null, msgs);
if (newPath != null)
msgs = ((InternalEObject)newPath).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ApplauseDslPackage.REST_SPECIFICATION__PATH, null, msgs);
msgs = basicSetPath(newPath, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ApplauseDslPackage.REST_SPECIFICATION__PATH, newPath, newPath));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DataSourceBodySpecification getBody()
{
return body;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetBody(DataSourceBodySpecification newBody, NotificationChain msgs)
{
DataSourceBodySpecification oldBody = body;
body = newBody;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ApplauseDslPackage.REST_SPECIFICATION__BODY, oldBody, newBody);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBody(DataSourceBodySpecification newBody)
{
if (newBody != body)
{
NotificationChain msgs = null;
if (body != null)
msgs = ((InternalEObject)body).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ApplauseDslPackage.REST_SPECIFICATION__BODY, null, msgs);
if (newBody != null)
msgs = ((InternalEObject)newBody).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ApplauseDslPackage.REST_SPECIFICATION__BODY, null, msgs);
msgs = basicSetBody(newBody, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ApplauseDslPackage.REST_SPECIFICATION__BODY, newBody, newBody));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case ApplauseDslPackage.REST_SPECIFICATION__PATH:
return basicSetPath(null, msgs);
case ApplauseDslPackage.REST_SPECIFICATION__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 ApplauseDslPackage.REST_SPECIFICATION__VERB:
return getVerb();
case ApplauseDslPackage.REST_SPECIFICATION__PATH:
return getPath();
case ApplauseDslPackage.REST_SPECIFICATION__BODY:
return getBody();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case ApplauseDslPackage.REST_SPECIFICATION__VERB:
setVerb((RESTVerb)newValue);
return;
case ApplauseDslPackage.REST_SPECIFICATION__PATH:
setPath((RESTURL)newValue);
return;
case ApplauseDslPackage.REST_SPECIFICATION__BODY:
setBody((DataSourceBodySpecification)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case ApplauseDslPackage.REST_SPECIFICATION__VERB:
setVerb(VERB_EDEFAULT);
return;
case ApplauseDslPackage.REST_SPECIFICATION__PATH:
setPath((RESTURL)null);
return;
case ApplauseDslPackage.REST_SPECIFICATION__BODY:
setBody((DataSourceBodySpecification)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case ApplauseDslPackage.REST_SPECIFICATION__VERB:
return verb != VERB_EDEFAULT;
case ApplauseDslPackage.REST_SPECIFICATION__PATH:
return path != null;
case ApplauseDslPackage.REST_SPECIFICATION__BODY:
return body != 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(" (verb: ");
result.append(verb);
result.append(')');
return result.toString();
}
} //RESTSpecificationImpl