/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.eclipse.papyrus.views.properties.environment.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.papyrus.views.properties.environment.EnvironmentPackage;
import org.eclipse.papyrus.views.properties.environment.PropertyEditorType;
import org.eclipse.papyrus.views.properties.environment.Type;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Property Editor Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.papyrus.views.properties.environment.impl.PropertyEditorTypeImpl#getType <em>Type</em>}</li>
* <li>{@link org.eclipse.papyrus.views.properties.environment.impl.PropertyEditorTypeImpl#getMultiplicity <em>Multiplicity</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class PropertyEditorTypeImpl extends WidgetTypeImpl implements PropertyEditorType {
/**
* The default value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected static final Type TYPE_EDEFAULT = Type.STRING;
/**
* The cached value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected Type type = TYPE_EDEFAULT;
/**
* The default value of the '{@link #getMultiplicity() <em>Multiplicity</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMultiplicity()
* @generated
* @ordered
*/
protected static final int MULTIPLICITY_EDEFAULT = 1;
/**
* The cached value of the '{@link #getMultiplicity() <em>Multiplicity</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMultiplicity()
* @generated
* @ordered
*/
protected int multiplicity = MULTIPLICITY_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PropertyEditorTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return EnvironmentPackage.Literals.PROPERTY_EDITOR_TYPE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type getType() {
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setType(Type newType) {
Type oldType = type;
type = newType == null ? TYPE_EDEFAULT : newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EnvironmentPackage.PROPERTY_EDITOR_TYPE__TYPE, oldType, type));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getMultiplicity() {
return multiplicity;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMultiplicity(int newMultiplicity) {
int oldMultiplicity = multiplicity;
multiplicity = newMultiplicity;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EnvironmentPackage.PROPERTY_EDITOR_TYPE__MULTIPLICITY, oldMultiplicity, multiplicity));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case EnvironmentPackage.PROPERTY_EDITOR_TYPE__TYPE:
return getType();
case EnvironmentPackage.PROPERTY_EDITOR_TYPE__MULTIPLICITY:
return getMultiplicity();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case EnvironmentPackage.PROPERTY_EDITOR_TYPE__TYPE:
setType((Type)newValue);
return;
case EnvironmentPackage.PROPERTY_EDITOR_TYPE__MULTIPLICITY:
setMultiplicity((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case EnvironmentPackage.PROPERTY_EDITOR_TYPE__TYPE:
setType(TYPE_EDEFAULT);
return;
case EnvironmentPackage.PROPERTY_EDITOR_TYPE__MULTIPLICITY:
setMultiplicity(MULTIPLICITY_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case EnvironmentPackage.PROPERTY_EDITOR_TYPE__TYPE:
return type != TYPE_EDEFAULT;
case EnvironmentPackage.PROPERTY_EDITOR_TYPE__MULTIPLICITY:
return multiplicity != MULTIPLICITY_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(" (type: ");
result.append(type);
result.append(", multiplicity: ");
result.append(multiplicity);
result.append(')');
return result.toString();
}
} //PropertyEditorTypeImpl