/**
* <copyright>
* </copyright>
*
* $Id: BasicImpl.java,v 1.7 2007/11/14 16:37:53 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.Basic;
import org.eclipse.emf.teneo.annotations.pannotation.FetchType;
import org.eclipse.emf.teneo.annotations.pannotation.PannotationPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Basic</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.BasicImpl#getFetch <em>Fetch</em>}</li>
* <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.BasicImpl#isOptional <em>Optional</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class BasicImpl extends PAnnotationImpl implements Basic {
/**
* The default value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFetch()
* @generated
* @ordered
*/
protected static final FetchType FETCH_EDEFAULT = FetchType.EAGER;
/**
* The cached value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFetch()
* @generated
* @ordered
*/
protected FetchType fetch = FETCH_EDEFAULT;
/**
* The default value of the '{@link #isOptional() <em>Optional</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isOptional()
* @generated
* @ordered
*/
protected static final boolean OPTIONAL_EDEFAULT = true;
/**
* The cached value of the '{@link #isOptional() <em>Optional</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isOptional()
* @generated
* @ordered
*/
protected boolean optional = OPTIONAL_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected BasicImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PannotationPackage.Literals.BASIC;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FetchType getFetch() {
return fetch;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFetch(FetchType newFetch) {
FetchType oldFetch = fetch;
fetch = newFetch == null ? FETCH_EDEFAULT : newFetch;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PannotationPackage.BASIC__FETCH, oldFetch, fetch));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isOptional() {
return optional;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOptional(boolean newOptional) {
boolean oldOptional = optional;
optional = newOptional;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PannotationPackage.BASIC__OPTIONAL, oldOptional, optional));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case PannotationPackage.BASIC__FETCH:
return getFetch();
case PannotationPackage.BASIC__OPTIONAL:
return isOptional() ? Boolean.TRUE : Boolean.FALSE;
}
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.BASIC__FETCH:
setFetch((FetchType)newValue);
return;
case PannotationPackage.BASIC__OPTIONAL:
setOptional(((Boolean)newValue).booleanValue());
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PannotationPackage.BASIC__FETCH:
setFetch(FETCH_EDEFAULT);
return;
case PannotationPackage.BASIC__OPTIONAL:
setOptional(OPTIONAL_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PannotationPackage.BASIC__FETCH:
return fetch != FETCH_EDEFAULT;
case PannotationPackage.BASIC__OPTIONAL:
return optional != OPTIONAL_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(" (fetch: ");
result.append(fetch);
result.append(", optional: ");
result.append(optional);
result.append(')');
return result.toString();
}
} //BasicImpl