/**
* <copyright>
* </copyright>
*
* $Id: ColumnImpl.java,v 1.9 2008/04/11 23:42:48 mtaal Exp $
*/
package org.eclipse.emf.teneo.annotations.pannotation.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.teneo.annotations.pannotation.Column;
import org.eclipse.emf.teneo.annotations.pannotation.PannotationPackage;
/**
* <!-- begin-user-doc --> An implementation of the model object '<em><b>Column</b></em>'. <!--
* end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.ColumnImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.ColumnImpl#isUnique <em>Unique</em>}</li>
* <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.ColumnImpl#isNullable <em>Nullable</em>}</li>
* <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.ColumnImpl#isInsertable <em>Insertable</em>}</li>
* <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.ColumnImpl#isUpdatable <em>Updatable</em>}</li>
* <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.ColumnImpl#getColumnDefinition <em>Column Definition</em>}</li>
* <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.ColumnImpl#getTable <em>Table</em>}</li>
* <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.ColumnImpl#getLength <em>Length</em>}</li>
* <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.ColumnImpl#getPrecision <em>Precision</em>}</li>
* <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.ColumnImpl#getScale <em>Scale</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ColumnImpl extends PAnnotationImpl implements Column {
/**
* 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 default value of the '{@link #isUnique() <em>Unique</em>}' attribute. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #isUnique()
* @generated
* @ordered
*/
protected static final boolean UNIQUE_EDEFAULT = false;
/**
* The cached value of the '{@link #isUnique() <em>Unique</em>}' attribute. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #isUnique()
* @generated
* @ordered
*/
protected boolean unique = UNIQUE_EDEFAULT;
/**
* The default value of the '{@link #isNullable() <em>Nullable</em>}' attribute. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #isNullable()
* @generated
* @ordered
*/
protected static final boolean NULLABLE_EDEFAULT = true;
/**
* The cached value of the '{@link #isNullable() <em>Nullable</em>}' attribute. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #isNullable()
* @generated
* @ordered
*/
protected boolean nullable = NULLABLE_EDEFAULT;
/**
* This is true if the Nullable attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean nullableESet;
/**
* The default value of the '{@link #isInsertable() <em>Insertable</em>}' attribute. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #isInsertable()
* @generated
* @ordered
*/
protected static final boolean INSERTABLE_EDEFAULT = true;
/**
* The cached value of the '{@link #isInsertable() <em>Insertable</em>}' attribute. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #isInsertable()
* @generated
* @ordered
*/
protected boolean insertable = INSERTABLE_EDEFAULT;
/**
* The default value of the '{@link #isUpdatable() <em>Updatable</em>}' attribute. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #isUpdatable()
* @generated
* @ordered
*/
protected static final boolean UPDATABLE_EDEFAULT = true;
/**
* The cached value of the '{@link #isUpdatable() <em>Updatable</em>}' attribute. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #isUpdatable()
* @generated
* @ordered
*/
protected boolean updatable = UPDATABLE_EDEFAULT;
/**
* 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 #getTable() <em>Table</em>}' attribute. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #getTable()
* @generated
* @ordered
*/
protected static final String TABLE_EDEFAULT = null;
/**
* The cached value of the '{@link #getTable() <em>Table</em>}' attribute.
* <!-- begin-user-doc
* --> <!-- end-user-doc -->
* @see #getTable()
* @generated
* @ordered
*/
protected String table = TABLE_EDEFAULT;
/**
* 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 = 255;
/**
* 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 #getPrecision() <em>Precision</em>}' attribute. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #getPrecision()
* @generated
* @ordered
*/
protected static final int PRECISION_EDEFAULT = 0;
/**
* The cached value of the '{@link #getPrecision() <em>Precision</em>}' attribute. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #getPrecision()
* @generated
* @ordered
*/
protected int precision = PRECISION_EDEFAULT;
/**
* This is true if the Precision attribute has been set.
* <!-- begin-user-doc --> <!--
* end-user-doc -->
* @generated
* @ordered
*/
protected boolean precisionESet;
/**
* The default value of the '{@link #getScale() <em>Scale</em>}' attribute. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #getScale()
* @generated
* @ordered
*/
protected static final int SCALE_EDEFAULT = 0;
/**
* The cached value of the '{@link #getScale() <em>Scale</em>}' attribute.
* <!-- begin-user-doc
* --> <!-- end-user-doc -->
* @see #getScale()
* @generated
* @ordered
*/
protected int scale = SCALE_EDEFAULT;
/**
* This is true if the Scale attribute has been set. <!-- begin-user-doc --> <!-- end-user-doc
* -->
*
* @generated
* @ordered
*/
protected boolean scaleESet;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
protected ColumnImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PannotationPackage.Literals.COLUMN;
}
/**
* <!-- 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, PannotationPackage.COLUMN__NAME, oldName, name));
}
/**
* <!-- 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, PannotationPackage.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, PannotationPackage.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 int getScale() {
return scale;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setScale(int newScale) {
int oldScale = scale;
scale = newScale;
boolean oldScaleESet = scaleESet;
scaleESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PannotationPackage.COLUMN__SCALE, oldScale, scale, !oldScaleESet));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void unsetScale() {
int oldScale = scale;
boolean oldScaleESet = scaleESet;
scale = SCALE_EDEFAULT;
scaleESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, PannotationPackage.COLUMN__SCALE, oldScale, SCALE_EDEFAULT, oldScaleESet));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public boolean isSetScale() {
return scaleESet;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case PannotationPackage.COLUMN__NAME:
return getName();
case PannotationPackage.COLUMN__UNIQUE:
return isUnique() ? Boolean.TRUE : Boolean.FALSE;
case PannotationPackage.COLUMN__NULLABLE:
return isNullable() ? Boolean.TRUE : Boolean.FALSE;
case PannotationPackage.COLUMN__INSERTABLE:
return isInsertable() ? Boolean.TRUE : Boolean.FALSE;
case PannotationPackage.COLUMN__UPDATABLE:
return isUpdatable() ? Boolean.TRUE : Boolean.FALSE;
case PannotationPackage.COLUMN__COLUMN_DEFINITION:
return getColumnDefinition();
case PannotationPackage.COLUMN__TABLE:
return getTable();
case PannotationPackage.COLUMN__LENGTH:
return new Integer(getLength());
case PannotationPackage.COLUMN__PRECISION:
return new Integer(getPrecision());
case PannotationPackage.COLUMN__SCALE:
return new Integer(getScale());
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case PannotationPackage.COLUMN__NAME:
setName((String)newValue);
return;
case PannotationPackage.COLUMN__UNIQUE:
setUnique(((Boolean)newValue).booleanValue());
return;
case PannotationPackage.COLUMN__NULLABLE:
setNullable(((Boolean)newValue).booleanValue());
return;
case PannotationPackage.COLUMN__INSERTABLE:
setInsertable(((Boolean)newValue).booleanValue());
return;
case PannotationPackage.COLUMN__UPDATABLE:
setUpdatable(((Boolean)newValue).booleanValue());
return;
case PannotationPackage.COLUMN__COLUMN_DEFINITION:
setColumnDefinition((String)newValue);
return;
case PannotationPackage.COLUMN__TABLE:
setTable((String)newValue);
return;
case PannotationPackage.COLUMN__LENGTH:
setLength(((Integer)newValue).intValue());
return;
case PannotationPackage.COLUMN__PRECISION:
setPrecision(((Integer)newValue).intValue());
return;
case PannotationPackage.COLUMN__SCALE:
setScale(((Integer)newValue).intValue());
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PannotationPackage.COLUMN__NAME:
setName(NAME_EDEFAULT);
return;
case PannotationPackage.COLUMN__UNIQUE:
setUnique(UNIQUE_EDEFAULT);
return;
case PannotationPackage.COLUMN__NULLABLE:
unsetNullable();
return;
case PannotationPackage.COLUMN__INSERTABLE:
setInsertable(INSERTABLE_EDEFAULT);
return;
case PannotationPackage.COLUMN__UPDATABLE:
setUpdatable(UPDATABLE_EDEFAULT);
return;
case PannotationPackage.COLUMN__COLUMN_DEFINITION:
setColumnDefinition(COLUMN_DEFINITION_EDEFAULT);
return;
case PannotationPackage.COLUMN__TABLE:
setTable(TABLE_EDEFAULT);
return;
case PannotationPackage.COLUMN__LENGTH:
unsetLength();
return;
case PannotationPackage.COLUMN__PRECISION:
unsetPrecision();
return;
case PannotationPackage.COLUMN__SCALE:
unsetScale();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PannotationPackage.COLUMN__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case PannotationPackage.COLUMN__UNIQUE:
return unique != UNIQUE_EDEFAULT;
case PannotationPackage.COLUMN__NULLABLE:
return isSetNullable();
case PannotationPackage.COLUMN__INSERTABLE:
return insertable != INSERTABLE_EDEFAULT;
case PannotationPackage.COLUMN__UPDATABLE:
return updatable != UPDATABLE_EDEFAULT;
case PannotationPackage.COLUMN__COLUMN_DEFINITION:
return COLUMN_DEFINITION_EDEFAULT == null ? columnDefinition != null : !COLUMN_DEFINITION_EDEFAULT.equals(columnDefinition);
case PannotationPackage.COLUMN__TABLE:
return TABLE_EDEFAULT == null ? table != null : !TABLE_EDEFAULT.equals(table);
case PannotationPackage.COLUMN__LENGTH:
return isSetLength();
case PannotationPackage.COLUMN__PRECISION:
return isSetPrecision();
case PannotationPackage.COLUMN__SCALE:
return isSetScale();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public boolean isUnique() {
return unique;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setUnique(boolean newUnique) {
boolean oldUnique = unique;
unique = newUnique;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PannotationPackage.COLUMN__UNIQUE, oldUnique, unique));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public int getPrecision() {
return precision;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setPrecision(int newPrecision) {
int oldPrecision = precision;
precision = newPrecision;
boolean oldPrecisionESet = precisionESet;
precisionESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PannotationPackage.COLUMN__PRECISION, oldPrecision, precision, !oldPrecisionESet));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void unsetPrecision() {
int oldPrecision = precision;
boolean oldPrecisionESet = precisionESet;
precision = PRECISION_EDEFAULT;
precisionESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, PannotationPackage.COLUMN__PRECISION, oldPrecision, PRECISION_EDEFAULT, oldPrecisionESet));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public boolean isSetPrecision() {
return precisionESet;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public boolean isNullable() {
return nullable;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setNullable(boolean newNullable) {
boolean oldNullable = nullable;
nullable = newNullable;
boolean oldNullableESet = nullableESet;
nullableESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PannotationPackage.COLUMN__NULLABLE, oldNullable, nullable, !oldNullableESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetNullable() {
boolean oldNullable = nullable;
boolean oldNullableESet = nullableESet;
nullable = NULLABLE_EDEFAULT;
nullableESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, PannotationPackage.COLUMN__NULLABLE, oldNullable, NULLABLE_EDEFAULT, oldNullableESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetNullable() {
return nullableESet;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public boolean isInsertable() {
return insertable;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setInsertable(boolean newInsertable) {
boolean oldInsertable = insertable;
insertable = newInsertable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PannotationPackage.COLUMN__INSERTABLE, oldInsertable, insertable));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public boolean isUpdatable() {
return updatable;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setUpdatable(boolean newUpdatable) {
boolean oldUpdatable = updatable;
updatable = newUpdatable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PannotationPackage.COLUMN__UPDATABLE, oldUpdatable, updatable));
}
/**
* <!-- 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, PannotationPackage.COLUMN__COLUMN_DEFINITION, oldColumnDefinition, columnDefinition));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public String getTable() {
return table;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setTable(String newTable) {
String oldTable = table;
table = newTable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PannotationPackage.COLUMN__TABLE, oldTable, table));
}
/**
* <!-- 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(", unique: ");
result.append(unique);
result.append(", nullable: ");
if (nullableESet) result.append(nullable); else result.append("<unset>");
result.append(", insertable: ");
result.append(insertable);
result.append(", updatable: ");
result.append(updatable);
result.append(", columnDefinition: ");
result.append(columnDefinition);
result.append(", table: ");
result.append(table);
result.append(", length: ");
if (lengthESet) result.append(length); else result.append("<unset>");
result.append(", precision: ");
if (precisionESet) result.append(precision); else result.append("<unset>");
result.append(", scale: ");
if (scaleESet) result.append(scale); else result.append("<unset>");
result.append(')');
return result.toString();
}
} // ColumnImpl