/**
*/
package de.gebit.integrity.dsl.impl;
import de.gebit.integrity.dsl.DslPackage;
import de.gebit.integrity.dsl.JavaConstantReference;
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.MinimalEObjectImpl;
import org.eclipse.xtext.common.types.JvmField;
import org.eclipse.xtext.common.types.JvmType;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Java Constant Reference</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link de.gebit.integrity.dsl.impl.JavaConstantReferenceImpl#getType <em>Type</em>}</li>
* <li>{@link de.gebit.integrity.dsl.impl.JavaConstantReferenceImpl#getConstant <em>Constant</em>}</li>
* </ul>
*
* @generated
*/
public class JavaConstantReferenceImpl extends MinimalEObjectImpl.Container implements JavaConstantReference
{
/**
* The cached value of the '{@link #getType() <em>Type</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected JvmType type;
/**
* The cached value of the '{@link #getConstant() <em>Constant</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConstant()
* @generated
* @ordered
*/
protected JvmField constant;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected JavaConstantReferenceImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return DslPackage.Literals.JAVA_CONSTANT_REFERENCE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public JvmType getType()
{
if (type != null && type.eIsProxy())
{
InternalEObject oldType = (InternalEObject)type;
type = (JvmType)eResolveProxy(oldType);
if (type != oldType)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, DslPackage.JAVA_CONSTANT_REFERENCE__TYPE, oldType, type));
}
}
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public JvmType basicGetType()
{
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setType(JvmType newType)
{
JvmType oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.JAVA_CONSTANT_REFERENCE__TYPE, oldType, type));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public JvmField getConstant()
{
if (constant != null && constant.eIsProxy())
{
InternalEObject oldConstant = (InternalEObject)constant;
constant = (JvmField)eResolveProxy(oldConstant);
if (constant != oldConstant)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, DslPackage.JAVA_CONSTANT_REFERENCE__CONSTANT, oldConstant, constant));
}
}
return constant;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public JvmField basicGetConstant()
{
return constant;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setConstant(JvmField newConstant)
{
JvmField oldConstant = constant;
constant = newConstant;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.JAVA_CONSTANT_REFERENCE__CONSTANT, oldConstant, constant));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case DslPackage.JAVA_CONSTANT_REFERENCE__TYPE:
if (resolve) return getType();
return basicGetType();
case DslPackage.JAVA_CONSTANT_REFERENCE__CONSTANT:
if (resolve) return getConstant();
return basicGetConstant();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case DslPackage.JAVA_CONSTANT_REFERENCE__TYPE:
setType((JvmType)newValue);
return;
case DslPackage.JAVA_CONSTANT_REFERENCE__CONSTANT:
setConstant((JvmField)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case DslPackage.JAVA_CONSTANT_REFERENCE__TYPE:
setType((JvmType)null);
return;
case DslPackage.JAVA_CONSTANT_REFERENCE__CONSTANT:
setConstant((JvmField)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case DslPackage.JAVA_CONSTANT_REFERENCE__TYPE:
return type != null;
case DslPackage.JAVA_CONSTANT_REFERENCE__CONSTANT:
return constant != null;
}
return super.eIsSet(featureID);
}
} //JavaConstantReferenceImpl