/** * <copyright> * </copyright> * * $Id$ */ package org.eclipse.emf.texo.orm.annotations.model.orm.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.emf.texo.orm.annotations.model.orm.AccessMethods; import org.eclipse.emf.texo.orm.annotations.model.orm.AccessType; import org.eclipse.emf.texo.orm.annotations.model.orm.OrmPackage; import org.eclipse.emf.texo.orm.annotations.model.orm.Property; import org.eclipse.emf.texo.orm.annotations.model.orm.Structure; import org.eclipse.emf.texo.orm.annotator.BaseOrmAnnotationImpl; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Structure</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.emf.texo.orm.annotations.model.orm.impl.StructureImpl#getProperty <em>Property</em>}</li> * <li>{@link org.eclipse.emf.texo.orm.annotations.model.orm.impl.StructureImpl#getAccessMethods <em>Access Methods</em>}</li> * <li>{@link org.eclipse.emf.texo.orm.annotations.model.orm.impl.StructureImpl#getAccess <em>Access</em>}</li> * <li>{@link org.eclipse.emf.texo.orm.annotations.model.orm.impl.StructureImpl#getAttributeType <em>Attribute Type</em>}</li> * <li>{@link org.eclipse.emf.texo.orm.annotations.model.orm.impl.StructureImpl#getName <em>Name</em>}</li> * </ul> * </p> * * @generated */ public class StructureImpl extends BaseOrmAnnotationImpl implements Structure { /** * The cached value of the '{@link #getProperty() <em>Property</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getProperty() * @generated * @ordered */ protected EList<Property> property; /** * The cached value of the '{@link #getAccessMethods() <em>Access Methods</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getAccessMethods() * @generated * @ordered */ protected AccessMethods accessMethods; /** * The default value of the '{@link #getAccess() <em>Access</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getAccess() * @generated * @ordered */ protected static final AccessType ACCESS_EDEFAULT = AccessType.PROPERTY; /** * The cached value of the '{@link #getAccess() <em>Access</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getAccess() * @generated * @ordered */ protected AccessType access = ACCESS_EDEFAULT; /** * This is true if the Access attribute has been set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ protected boolean accessESet; /** * The default value of the '{@link #getAttributeType() <em>Attribute Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getAttributeType() * @generated * @ordered */ protected static final String ATTRIBUTE_TYPE_EDEFAULT = null; /** * The cached value of the '{@link #getAttributeType() <em>Attribute Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getAttributeType() * @generated * @ordered */ protected String attributeType = ATTRIBUTE_TYPE_EDEFAULT; /** * 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; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected StructureImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return OrmPackage.eINSTANCE.getStructure(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Property> getProperty() { if (property == null) { property = new EObjectContainmentEList<Property>(Property.class, this, OrmPackage.STRUCTURE__PROPERTY); } return property; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AccessMethods getAccessMethods() { return accessMethods; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetAccessMethods(AccessMethods newAccessMethods, NotificationChain msgs) { AccessMethods oldAccessMethods = accessMethods; accessMethods = newAccessMethods; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.STRUCTURE__ACCESS_METHODS, oldAccessMethods, newAccessMethods); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setAccessMethods(AccessMethods newAccessMethods) { if (newAccessMethods != accessMethods) { NotificationChain msgs = null; if (accessMethods != null) msgs = ((InternalEObject)accessMethods).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.STRUCTURE__ACCESS_METHODS, null, msgs); if (newAccessMethods != null) msgs = ((InternalEObject)newAccessMethods).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.STRUCTURE__ACCESS_METHODS, null, msgs); msgs = basicSetAccessMethods(newAccessMethods, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.STRUCTURE__ACCESS_METHODS, newAccessMethods, newAccessMethods)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AccessType getAccess() { return access; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setAccess(AccessType newAccess) { AccessType oldAccess = access; access = newAccess == null ? ACCESS_EDEFAULT : newAccess; boolean oldAccessESet = accessESet; accessESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.STRUCTURE__ACCESS, oldAccess, access, !oldAccessESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void unsetAccess() { AccessType oldAccess = access; boolean oldAccessESet = accessESet; access = ACCESS_EDEFAULT; accessESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, OrmPackage.STRUCTURE__ACCESS, oldAccess, ACCESS_EDEFAULT, oldAccessESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isSetAccess() { return accessESet; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getAttributeType() { return attributeType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setAttributeType(String newAttributeType) { String oldAttributeType = attributeType; attributeType = newAttributeType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.STRUCTURE__ATTRIBUTE_TYPE, oldAttributeType, attributeType)); } /** * <!-- 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, OrmPackage.STRUCTURE__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case OrmPackage.STRUCTURE__PROPERTY: return ((InternalEList<?>)getProperty()).basicRemove(otherEnd, msgs); case OrmPackage.STRUCTURE__ACCESS_METHODS: return basicSetAccessMethods(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 OrmPackage.STRUCTURE__PROPERTY: return getProperty(); case OrmPackage.STRUCTURE__ACCESS_METHODS: return getAccessMethods(); case OrmPackage.STRUCTURE__ACCESS: return getAccess(); case OrmPackage.STRUCTURE__ATTRIBUTE_TYPE: return getAttributeType(); case OrmPackage.STRUCTURE__NAME: return getName(); } 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 OrmPackage.STRUCTURE__PROPERTY: getProperty().clear(); getProperty().addAll((Collection<? extends Property>)newValue); return; case OrmPackage.STRUCTURE__ACCESS_METHODS: setAccessMethods((AccessMethods)newValue); return; case OrmPackage.STRUCTURE__ACCESS: setAccess((AccessType)newValue); return; case OrmPackage.STRUCTURE__ATTRIBUTE_TYPE: setAttributeType((String)newValue); return; case OrmPackage.STRUCTURE__NAME: setName((String)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case OrmPackage.STRUCTURE__PROPERTY: getProperty().clear(); return; case OrmPackage.STRUCTURE__ACCESS_METHODS: setAccessMethods((AccessMethods)null); return; case OrmPackage.STRUCTURE__ACCESS: unsetAccess(); return; case OrmPackage.STRUCTURE__ATTRIBUTE_TYPE: setAttributeType(ATTRIBUTE_TYPE_EDEFAULT); return; case OrmPackage.STRUCTURE__NAME: setName(NAME_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case OrmPackage.STRUCTURE__PROPERTY: return property != null && !property.isEmpty(); case OrmPackage.STRUCTURE__ACCESS_METHODS: return accessMethods != null; case OrmPackage.STRUCTURE__ACCESS: return isSetAccess(); case OrmPackage.STRUCTURE__ATTRIBUTE_TYPE: return ATTRIBUTE_TYPE_EDEFAULT == null ? attributeType != null : !ATTRIBUTE_TYPE_EDEFAULT.equals(attributeType); case OrmPackage.STRUCTURE__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); } 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(" (access: "); //$NON-NLS-1$ if (accessESet) result.append(access); else result.append("<unset>"); //$NON-NLS-1$ result.append(", attributeType: "); //$NON-NLS-1$ result.append(attributeType); result.append(", name: "); //$NON-NLS-1$ result.append(name); result.append(')'); return result.toString(); } } //StructureImpl