/** * <copyright> * </copyright> * * $Id: DiscriminatorColumnImpl.java,v 1.5 2011/10/25 13:25:23 mtaal Exp $ */ package org.eclipse.emf.texo.orm.annotations.model.orm.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.texo.orm.annotations.model.orm.DiscriminatorColumn; import org.eclipse.emf.texo.orm.annotations.model.orm.DiscriminatorType; import org.eclipse.emf.texo.orm.annotations.model.orm.OrmPackage; import org.eclipse.emf.texo.orm.annotator.BaseOrmAnnotationImpl; /** * <!-- begin-user-doc --> An implementation of the model object '<em><b>Discriminator Column</b></em>'. <!-- * end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.emf.texo.orm.annotations.model.orm.impl.DiscriminatorColumnImpl#getColumnDefinition <em>Column Definition</em>}</li> * <li>{@link org.eclipse.emf.texo.orm.annotations.model.orm.impl.DiscriminatorColumnImpl#getDiscriminatorType <em>Discriminator Type</em>}</li> * <li>{@link org.eclipse.emf.texo.orm.annotations.model.orm.impl.DiscriminatorColumnImpl#getLength <em>Length</em>}</li> * <li>{@link org.eclipse.emf.texo.orm.annotations.model.orm.impl.DiscriminatorColumnImpl#getName <em>Name</em>}</li> * </ul> * </p> * * @generated */ public class DiscriminatorColumnImpl extends BaseOrmAnnotationImpl implements DiscriminatorColumn { /** * The default value of the '{@link #getColumnDefinition() <em>Column Definition</em>}' attribute. * <!-- begin-user-doc * --> <!-- end-user-doc --> * @see #getColumnDefinition() * @generated * @ordered */ protected static final String COLUMN_DEFINITION_EDEFAULT = null; /** * The cached value of the '{@link #getColumnDefinition() <em>Column Definition</em>}' attribute. * <!-- begin-user-doc * --> <!-- end-user-doc --> * @see #getColumnDefinition() * @generated * @ordered */ protected String columnDefinition = COLUMN_DEFINITION_EDEFAULT; /** * The default value of the '{@link #getDiscriminatorType() <em>Discriminator Type</em>}' attribute. <!-- * begin-user-doc --> <!-- end-user-doc --> * * @see #getDiscriminatorType() * @generated * @ordered */ protected static final DiscriminatorType DISCRIMINATOR_TYPE_EDEFAULT = DiscriminatorType.STRING; /** * The cached value of the '{@link #getDiscriminatorType() <em>Discriminator Type</em>}' attribute. <!-- * begin-user-doc --> <!-- end-user-doc --> * * @see #getDiscriminatorType() * @generated * @ordered */ protected DiscriminatorType discriminatorType = DISCRIMINATOR_TYPE_EDEFAULT; /** * This is true if the Discriminator Type attribute has been set. * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated * @ordered */ protected boolean discriminatorTypeESet; /** * The default value of the '{@link #getLength() <em>Length</em>}' attribute. * <!-- begin-user-doc --> <!-- * end-user-doc --> * @see #getLength() * @generated * @ordered */ protected static final int LENGTH_EDEFAULT = 0; /** * The cached value of the '{@link #getLength() <em>Length</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc * --> * * @see #getLength() * @generated * @ordered */ protected int length = LENGTH_EDEFAULT; /** * This is true if the Length attribute has been set. * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated * @ordered */ protected boolean lengthESet; /** * 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 DiscriminatorColumnImpl() { super(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return OrmPackage.eINSTANCE.getDiscriminatorColumn(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public String getColumnDefinition() { return columnDefinition; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void setColumnDefinition(String newColumnDefinition) { String oldColumnDefinition = columnDefinition; columnDefinition = newColumnDefinition; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION, oldColumnDefinition, columnDefinition)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public DiscriminatorType getDiscriminatorType() { return discriminatorType; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void setDiscriminatorType(DiscriminatorType newDiscriminatorType) { DiscriminatorType oldDiscriminatorType = discriminatorType; discriminatorType = newDiscriminatorType == null ? DISCRIMINATOR_TYPE_EDEFAULT : newDiscriminatorType; boolean oldDiscriminatorTypeESet = discriminatorTypeESet; discriminatorTypeESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE, oldDiscriminatorType, discriminatorType, !oldDiscriminatorTypeESet)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void unsetDiscriminatorType() { DiscriminatorType oldDiscriminatorType = discriminatorType; boolean oldDiscriminatorTypeESet = discriminatorTypeESet; discriminatorType = DISCRIMINATOR_TYPE_EDEFAULT; discriminatorTypeESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, OrmPackage.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE, oldDiscriminatorType, DISCRIMINATOR_TYPE_EDEFAULT, oldDiscriminatorTypeESet)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public boolean isSetDiscriminatorType() { return discriminatorTypeESet; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public int getLength() { return length; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void setLength(int newLength) { int oldLength = length; length = newLength; boolean oldLengthESet = lengthESet; lengthESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.DISCRIMINATOR_COLUMN__LENGTH, oldLength, length, !oldLengthESet)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void unsetLength() { int oldLength = length; boolean oldLengthESet = lengthESet; length = LENGTH_EDEFAULT; lengthESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, OrmPackage.DISCRIMINATOR_COLUMN__LENGTH, oldLength, LENGTH_EDEFAULT, oldLengthESet)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public boolean isSetLength() { return lengthESet; } /** * <!-- 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.DISCRIMINATOR_COLUMN__NAME, oldName, name)); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case OrmPackage.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION: return getColumnDefinition(); case OrmPackage.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE: return getDiscriminatorType(); case OrmPackage.DISCRIMINATOR_COLUMN__LENGTH: return getLength(); case OrmPackage.DISCRIMINATOR_COLUMN__NAME: return getName(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case OrmPackage.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION: setColumnDefinition((String)newValue); return; case OrmPackage.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE: setDiscriminatorType((DiscriminatorType)newValue); return; case OrmPackage.DISCRIMINATOR_COLUMN__LENGTH: setLength((Integer)newValue); return; case OrmPackage.DISCRIMINATOR_COLUMN__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.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION: setColumnDefinition(COLUMN_DEFINITION_EDEFAULT); return; case OrmPackage.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE: unsetDiscriminatorType(); return; case OrmPackage.DISCRIMINATOR_COLUMN__LENGTH: unsetLength(); return; case OrmPackage.DISCRIMINATOR_COLUMN__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.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION: return COLUMN_DEFINITION_EDEFAULT == null ? columnDefinition != null : !COLUMN_DEFINITION_EDEFAULT.equals(columnDefinition); case OrmPackage.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE: return isSetDiscriminatorType(); case OrmPackage.DISCRIMINATOR_COLUMN__LENGTH: return isSetLength(); case OrmPackage.DISCRIMINATOR_COLUMN__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(" (columnDefinition: "); //$NON-NLS-1$ result.append(columnDefinition); result.append(", discriminatorType: "); //$NON-NLS-1$ if (discriminatorTypeESet) result.append(discriminatorType); else result.append("<unset>"); //$NON-NLS-1$ result.append(", length: "); //$NON-NLS-1$ if (lengthESet) result.append(length); else result.append("<unset>"); //$NON-NLS-1$ result.append(", name: "); //$NON-NLS-1$ result.append(name); result.append(')'); return result.toString(); } } // DiscriminatorColumnImpl