/**
* <copyright>
* </copyright>
*
* $Id$
*/
package de.twenty11.skysail.ext.forms.impl;
import de.twenty11.skysail.ext.forms.Field;
import de.twenty11.skysail.ext.forms.FormsPackage;
import de.twenty11.skysail.ext.forms.Value;
import org.eclipse.emf.common.notify.Notification;
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.EObjectImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Value</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link de.twenty11.skysail.ext.forms.impl.ValueImpl#getStringValue <em>String Value</em>}</li>
* <li>{@link de.twenty11.skysail.ext.forms.impl.ValueImpl#getField <em>Field</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ValueImpl extends EObjectImpl implements Value {
/**
* The default value of the '{@link #getStringValue() <em>String Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStringValue()
* @generated
* @ordered
*/
protected static final String STRING_VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getStringValue() <em>String Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStringValue()
* @generated
* @ordered
*/
protected String stringValue = STRING_VALUE_EDEFAULT;
/**
* The cached value of the '{@link #getField() <em>Field</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getField()
* @generated
* @ordered
*/
protected Field field;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ValueImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return FormsPackage.Literals.VALUE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getStringValue() {
return stringValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStringValue(String newStringValue) {
String oldStringValue = stringValue;
stringValue = newStringValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FormsPackage.VALUE__STRING_VALUE, oldStringValue, stringValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Field getField() {
if (field != null && field.eIsProxy()) {
InternalEObject oldField = (InternalEObject)field;
field = (Field)eResolveProxy(oldField);
if (field != oldField) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, FormsPackage.VALUE__FIELD, oldField, field));
}
}
return field;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Field basicGetField() {
return field;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setField(Field newField) {
Field oldField = field;
field = newField;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FormsPackage.VALUE__FIELD, oldField, field));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case FormsPackage.VALUE__STRING_VALUE:
return getStringValue();
case FormsPackage.VALUE__FIELD:
if (resolve) return getField();
return basicGetField();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case FormsPackage.VALUE__STRING_VALUE:
setStringValue((String)newValue);
return;
case FormsPackage.VALUE__FIELD:
setField((Field)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case FormsPackage.VALUE__STRING_VALUE:
setStringValue(STRING_VALUE_EDEFAULT);
return;
case FormsPackage.VALUE__FIELD:
setField((Field)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case FormsPackage.VALUE__STRING_VALUE:
return STRING_VALUE_EDEFAULT == null ? stringValue != null : !STRING_VALUE_EDEFAULT.equals(stringValue);
case FormsPackage.VALUE__FIELD:
return field != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (stringValue: ");
result.append(stringValue);
result.append(')');
return result.toString();
}
} //ValueImpl