/**
*/
package org.xtext.mongobeans.mongoBeans.impl;
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.xtext.common.types.JvmTypeReference;
import org.xtext.mongobeans.mongoBeans.MongoBean;
import org.xtext.mongobeans.mongoBeans.MongoBeansPackage;
import org.xtext.mongobeans.mongoBeans.MongoProperty;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Mongo Property</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.xtext.mongobeans.mongoBeans.impl.MongoPropertyImpl#getType <em>Type</em>}</li>
* <li>{@link org.xtext.mongobeans.mongoBeans.impl.MongoPropertyImpl#getInlineType <em>Inline Type</em>}</li>
* <li>{@link org.xtext.mongobeans.mongoBeans.impl.MongoPropertyImpl#isMany <em>Many</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class MongoPropertyImpl extends AbstractFeatureImpl implements MongoProperty
{
/**
* The cached value of the '{@link #getType() <em>Type</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected JvmTypeReference type;
/**
* The cached value of the '{@link #getInlineType() <em>Inline Type</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInlineType()
* @generated
* @ordered
*/
protected MongoBean inlineType;
/**
* The default value of the '{@link #isMany() <em>Many</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isMany()
* @generated
* @ordered
*/
protected static final boolean MANY_EDEFAULT = false;
/**
* The cached value of the '{@link #isMany() <em>Many</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isMany()
* @generated
* @ordered
*/
protected boolean many = MANY_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MongoPropertyImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return MongoBeansPackage.Literals.MONGO_PROPERTY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public JvmTypeReference getType()
{
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetType(JvmTypeReference newType, NotificationChain msgs)
{
JvmTypeReference oldType = type;
type = newType;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MongoBeansPackage.MONGO_PROPERTY__TYPE, oldType, newType);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setType(JvmTypeReference newType)
{
if (newType != type)
{
NotificationChain msgs = null;
if (type != null)
msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MongoBeansPackage.MONGO_PROPERTY__TYPE, null, msgs);
if (newType != null)
msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MongoBeansPackage.MONGO_PROPERTY__TYPE, null, msgs);
msgs = basicSetType(newType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MongoBeansPackage.MONGO_PROPERTY__TYPE, newType, newType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public MongoBean getInlineType()
{
return inlineType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetInlineType(MongoBean newInlineType, NotificationChain msgs)
{
MongoBean oldInlineType = inlineType;
inlineType = newInlineType;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MongoBeansPackage.MONGO_PROPERTY__INLINE_TYPE, oldInlineType, newInlineType);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setInlineType(MongoBean newInlineType)
{
if (newInlineType != inlineType)
{
NotificationChain msgs = null;
if (inlineType != null)
msgs = ((InternalEObject)inlineType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MongoBeansPackage.MONGO_PROPERTY__INLINE_TYPE, null, msgs);
if (newInlineType != null)
msgs = ((InternalEObject)newInlineType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MongoBeansPackage.MONGO_PROPERTY__INLINE_TYPE, null, msgs);
msgs = basicSetInlineType(newInlineType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MongoBeansPackage.MONGO_PROPERTY__INLINE_TYPE, newInlineType, newInlineType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isMany()
{
return many;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMany(boolean newMany)
{
boolean oldMany = many;
many = newMany;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MongoBeansPackage.MONGO_PROPERTY__MANY, oldMany, many));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case MongoBeansPackage.MONGO_PROPERTY__TYPE:
return basicSetType(null, msgs);
case MongoBeansPackage.MONGO_PROPERTY__INLINE_TYPE:
return basicSetInlineType(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 MongoBeansPackage.MONGO_PROPERTY__TYPE:
return getType();
case MongoBeansPackage.MONGO_PROPERTY__INLINE_TYPE:
return getInlineType();
case MongoBeansPackage.MONGO_PROPERTY__MANY:
return isMany();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case MongoBeansPackage.MONGO_PROPERTY__TYPE:
setType((JvmTypeReference)newValue);
return;
case MongoBeansPackage.MONGO_PROPERTY__INLINE_TYPE:
setInlineType((MongoBean)newValue);
return;
case MongoBeansPackage.MONGO_PROPERTY__MANY:
setMany((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case MongoBeansPackage.MONGO_PROPERTY__TYPE:
setType((JvmTypeReference)null);
return;
case MongoBeansPackage.MONGO_PROPERTY__INLINE_TYPE:
setInlineType((MongoBean)null);
return;
case MongoBeansPackage.MONGO_PROPERTY__MANY:
setMany(MANY_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case MongoBeansPackage.MONGO_PROPERTY__TYPE:
return type != null;
case MongoBeansPackage.MONGO_PROPERTY__INLINE_TYPE:
return inlineType != null;
case MongoBeansPackage.MONGO_PROPERTY__MANY:
return many != MANY_EDEFAULT;
}
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(" (many: ");
result.append(many);
result.append(')');
return result.toString();
}
} //MongoPropertyImpl