blob: 251b9f1f484060b87510bfb39800d9807a29894b [file] [log] [blame]
/**
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Based on ideas from Xtext, Xtend, Xcore
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - Initial implementation
*
*/
package org.eclipse.osbp.xtext.entitymock.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.osbp.dsl.semantic.entity.LEntityAttribute;
import org.eclipse.osbp.xtext.entitymock.EntityMockAttributeByObject;
import org.eclipse.osbp.xtext.entitymock.EntityMockDSLPackage;
import org.eclipse.osbp.xtext.entitymock.EntityMockObjectEnum;
import org.eclipse.osbp.xtext.entitymock.EntityMockReferencedObjectAttribute;
import org.eclipse.osbp.xtext.entitymock.EntityMockResourceAttribute;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Entity Mock Attribute By Object</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.entitymock.impl.EntityMockAttributeByObjectImpl#getAttributeRef <em>Attribute Ref</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.entitymock.impl.EntityMockAttributeByObjectImpl#getReference <em>Reference</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.entitymock.impl.EntityMockAttributeByObjectImpl#getResourceEnum <em>Resource Enum</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.entitymock.impl.EntityMockAttributeByObjectImpl#getResourceAttribute <em>Resource Attribute</em>}</li>
* </ul>
*
* @generated
*/
public class EntityMockAttributeByObjectImpl extends IEntityMockAttributeImpl implements EntityMockAttributeByObject {
/**
* The cached value of the '{@link #getAttributeRef() <em>Attribute Ref</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAttributeRef()
* @generated
* @ordered
*/
protected LEntityAttribute attributeRef;
/**
* The cached value of the '{@link #getReference() <em>Reference</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getReference()
* @generated
* @ordered
*/
protected EntityMockReferencedObjectAttribute reference;
/**
* The cached value of the '{@link #getResourceEnum() <em>Resource Enum</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getResourceEnum()
* @generated
* @ordered
*/
protected EntityMockObjectEnum resourceEnum;
/**
* The cached value of the '{@link #getResourceAttribute() <em>Resource Attribute</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getResourceAttribute()
* @generated
* @ordered
*/
protected EntityMockResourceAttribute resourceAttribute;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EntityMockAttributeByObjectImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return EntityMockDSLPackage.Literals.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LEntityAttribute getAttributeRef() {
if (attributeRef != null && attributeRef.eIsProxy()) {
InternalEObject oldAttributeRef = (InternalEObject)attributeRef;
attributeRef = (LEntityAttribute)eResolveProxy(oldAttributeRef);
if (attributeRef != oldAttributeRef) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__ATTRIBUTE_REF, oldAttributeRef, attributeRef));
}
}
return attributeRef;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LEntityAttribute basicGetAttributeRef() {
return attributeRef;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAttributeRef(LEntityAttribute newAttributeRef) {
LEntityAttribute oldAttributeRef = attributeRef;
attributeRef = newAttributeRef;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__ATTRIBUTE_REF, oldAttributeRef, attributeRef));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EntityMockReferencedObjectAttribute getReference() {
return reference;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetReference(EntityMockReferencedObjectAttribute newReference, NotificationChain msgs) {
EntityMockReferencedObjectAttribute oldReference = reference;
reference = newReference;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__REFERENCE, oldReference, newReference);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setReference(EntityMockReferencedObjectAttribute newReference) {
if (newReference != reference) {
NotificationChain msgs = null;
if (reference != null)
msgs = ((InternalEObject)reference).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__REFERENCE, null, msgs);
if (newReference != null)
msgs = ((InternalEObject)newReference).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__REFERENCE, null, msgs);
msgs = basicSetReference(newReference, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__REFERENCE, newReference, newReference));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EntityMockObjectEnum getResourceEnum() {
if (resourceEnum != null && resourceEnum.eIsProxy()) {
InternalEObject oldResourceEnum = (InternalEObject)resourceEnum;
resourceEnum = (EntityMockObjectEnum)eResolveProxy(oldResourceEnum);
if (resourceEnum != oldResourceEnum) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__RESOURCE_ENUM, oldResourceEnum, resourceEnum));
}
}
return resourceEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EntityMockObjectEnum basicGetResourceEnum() {
return resourceEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setResourceEnum(EntityMockObjectEnum newResourceEnum) {
EntityMockObjectEnum oldResourceEnum = resourceEnum;
resourceEnum = newResourceEnum;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__RESOURCE_ENUM, oldResourceEnum, resourceEnum));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EntityMockResourceAttribute getResourceAttribute() {
if (resourceAttribute != null && resourceAttribute.eIsProxy()) {
InternalEObject oldResourceAttribute = (InternalEObject)resourceAttribute;
resourceAttribute = (EntityMockResourceAttribute)eResolveProxy(oldResourceAttribute);
if (resourceAttribute != oldResourceAttribute) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__RESOURCE_ATTRIBUTE, oldResourceAttribute, resourceAttribute));
}
}
return resourceAttribute;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EntityMockResourceAttribute basicGetResourceAttribute() {
return resourceAttribute;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setResourceAttribute(EntityMockResourceAttribute newResourceAttribute) {
EntityMockResourceAttribute oldResourceAttribute = resourceAttribute;
resourceAttribute = newResourceAttribute;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__RESOURCE_ATTRIBUTE, oldResourceAttribute, resourceAttribute));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__REFERENCE:
return basicSetReference(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__ATTRIBUTE_REF:
if (resolve) return getAttributeRef();
return basicGetAttributeRef();
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__REFERENCE:
return getReference();
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__RESOURCE_ENUM:
if (resolve) return getResourceEnum();
return basicGetResourceEnum();
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__RESOURCE_ATTRIBUTE:
if (resolve) return getResourceAttribute();
return basicGetResourceAttribute();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__ATTRIBUTE_REF:
setAttributeRef((LEntityAttribute)newValue);
return;
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__REFERENCE:
setReference((EntityMockReferencedObjectAttribute)newValue);
return;
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__RESOURCE_ENUM:
setResourceEnum((EntityMockObjectEnum)newValue);
return;
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__RESOURCE_ATTRIBUTE:
setResourceAttribute((EntityMockResourceAttribute)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__ATTRIBUTE_REF:
setAttributeRef((LEntityAttribute)null);
return;
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__REFERENCE:
setReference((EntityMockReferencedObjectAttribute)null);
return;
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__RESOURCE_ENUM:
setResourceEnum((EntityMockObjectEnum)null);
return;
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__RESOURCE_ATTRIBUTE:
setResourceAttribute((EntityMockResourceAttribute)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__ATTRIBUTE_REF:
return attributeRef != null;
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__REFERENCE:
return reference != null;
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__RESOURCE_ENUM:
return resourceEnum != null;
case EntityMockDSLPackage.ENTITY_MOCK_ATTRIBUTE_BY_OBJECT__RESOURCE_ATTRIBUTE:
return resourceAttribute != null;
}
return super.eIsSet(featureID);
}
} //EntityMockAttributeByObjectImpl