/** */ package org.example.xbase.entities.entities.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.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.xtext.common.types.JvmTypeReference; import org.eclipse.xtext.xbase.XExpression; import org.example.xbase.entities.entities.Attribute; import org.example.xbase.entities.entities.EntitiesPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Attribute</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.example.xbase.entities.entities.impl.AttributeImpl#getType <em>Type</em>}</li> * <li>{@link org.example.xbase.entities.entities.impl.AttributeImpl#getName <em>Name</em>}</li> * <li>{@link org.example.xbase.entities.entities.impl.AttributeImpl#getInitexpression <em>Initexpression</em>}</li> * </ul> * </p> * * @generated */ public class AttributeImpl extends MinimalEObjectImpl.Container implements Attribute { /** * 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 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 #getInitexpression() <em>Initexpression</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getInitexpression() * @generated * @ordered */ protected XExpression initexpression; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected AttributeImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return EntitiesPackage.Literals.ATTRIBUTE; } /** * <!-- 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, EntitiesPackage.ATTRIBUTE__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 - EntitiesPackage.ATTRIBUTE__TYPE, null, msgs); if (newType != null) msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EntitiesPackage.ATTRIBUTE__TYPE, null, msgs); msgs = basicSetType(newType, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EntitiesPackage.ATTRIBUTE__TYPE, newType, newType)); } /** * <!-- 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, EntitiesPackage.ATTRIBUTE__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public XExpression getInitexpression() { return initexpression; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetInitexpression(XExpression newInitexpression, NotificationChain msgs) { XExpression oldInitexpression = initexpression; initexpression = newInitexpression; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EntitiesPackage.ATTRIBUTE__INITEXPRESSION, oldInitexpression, newInitexpression); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setInitexpression(XExpression newInitexpression) { if (newInitexpression != initexpression) { NotificationChain msgs = null; if (initexpression != null) msgs = ((InternalEObject)initexpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EntitiesPackage.ATTRIBUTE__INITEXPRESSION, null, msgs); if (newInitexpression != null) msgs = ((InternalEObject)newInitexpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EntitiesPackage.ATTRIBUTE__INITEXPRESSION, null, msgs); msgs = basicSetInitexpression(newInitexpression, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EntitiesPackage.ATTRIBUTE__INITEXPRESSION, newInitexpression, newInitexpression)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case EntitiesPackage.ATTRIBUTE__TYPE: return basicSetType(null, msgs); case EntitiesPackage.ATTRIBUTE__INITEXPRESSION: return basicSetInitexpression(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 EntitiesPackage.ATTRIBUTE__TYPE: return getType(); case EntitiesPackage.ATTRIBUTE__NAME: return getName(); case EntitiesPackage.ATTRIBUTE__INITEXPRESSION: return getInitexpression(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case EntitiesPackage.ATTRIBUTE__TYPE: setType((JvmTypeReference)newValue); return; case EntitiesPackage.ATTRIBUTE__NAME: setName((String)newValue); return; case EntitiesPackage.ATTRIBUTE__INITEXPRESSION: setInitexpression((XExpression)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case EntitiesPackage.ATTRIBUTE__TYPE: setType((JvmTypeReference)null); return; case EntitiesPackage.ATTRIBUTE__NAME: setName(NAME_EDEFAULT); return; case EntitiesPackage.ATTRIBUTE__INITEXPRESSION: setInitexpression((XExpression)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case EntitiesPackage.ATTRIBUTE__TYPE: return type != null; case EntitiesPackage.ATTRIBUTE__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case EntitiesPackage.ATTRIBUTE__INITEXPRESSION: return initexpression != 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(" (name: "); result.append(name); result.append(')'); return result.toString(); } } //AttributeImpl