View Javadoc

1   /**
2    * <copyright>
3    * </copyright>
4    *
5    * $Id$
6    */
7   package org.mod4j.dsl.datacontract.mm.DataContractDsl.impl;
8   
9   import org.eclipse.emf.common.notify.Notification;
10  import org.eclipse.emf.common.notify.NotificationChain;
11  
12  import org.eclipse.emf.ecore.EClass;
13  import org.eclipse.emf.ecore.InternalEObject;
14  
15  import org.eclipse.emf.ecore.impl.ENotificationImpl;
16  
17  import org.eclipse.emf.ecore.util.EcoreUtil;
18  
19  import org.mod4j.dsl.datacontract.mm.DataContractDsl.BusinessClassAssociationRoleReference;
20  import org.mod4j.dsl.datacontract.mm.DataContractDsl.BusinessClassDto;
21  import org.mod4j.dsl.datacontract.mm.DataContractDsl.DataContractDslPackage;
22  import org.mod4j.dsl.datacontract.mm.DataContractDsl.Dto;
23  
24  /**
25   * <!-- begin-user-doc -->
26   * An implementation of the model object '<em><b>Business Class Association Role Reference</b></em>'.
27   * <!-- end-user-doc -->
28   * <p>
29   * The following features are implemented:
30   * <ul>
31   *   <li>{@link org.mod4j.dsl.datacontract.mm.DataContractDsl.impl.BusinessClassAssociationRoleReferenceImpl#getDto <em>Dto</em>}</li>
32   *   <li>{@link org.mod4j.dsl.datacontract.mm.DataContractDsl.impl.BusinessClassAssociationRoleReferenceImpl#getDtoType <em>Dto Type</em>}</li>
33   * </ul>
34   * </p>
35   *
36   * @generated
37   */
38  public class BusinessClassAssociationRoleReferenceImpl extends ModelElementImpl implements BusinessClassAssociationRoleReference {
39  	/**
40       * The cached value of the '{@link #getDtoType() <em>Dto Type</em>}' reference.
41       * <!-- begin-user-doc -->
42  	 * <!-- end-user-doc -->
43       * @see #getDtoType()
44       * @generated
45       * @ordered
46       */
47  	protected Dto dtoType;
48  
49  	/**
50       * <!-- begin-user-doc -->
51  	 * <!-- end-user-doc -->
52       * @generated
53       */
54  	protected BusinessClassAssociationRoleReferenceImpl() {
55          super();
56      }
57  
58  	/**
59       * <!-- begin-user-doc -->
60  	 * <!-- end-user-doc -->
61       * @generated
62       */
63  	@Override
64  	protected EClass eStaticClass() {
65          return DataContractDslPackage.Literals.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE;
66      }
67  
68  	/**
69       * <!-- begin-user-doc -->
70  	 * <!-- end-user-doc -->
71       * @generated
72       */
73  	public BusinessClassDto getDto() {
74          if (eContainerFeatureID() != DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO) return null;
75          return (BusinessClassDto)eContainer();
76      }
77  
78  	/**
79       * <!-- begin-user-doc -->
80  	 * <!-- end-user-doc -->
81       * @generated
82       */
83  	public NotificationChain basicSetDto(BusinessClassDto newDto, NotificationChain msgs) {
84          msgs = eBasicSetContainer((InternalEObject)newDto, DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO, msgs);
85          return msgs;
86      }
87  
88  	/**
89       * <!-- begin-user-doc -->
90  	 * <!-- end-user-doc -->
91       * @generated
92       */
93  	public void setDto(BusinessClassDto newDto) {
94          if (newDto != eInternalContainer() || (eContainerFeatureID() != DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO && newDto != null)) {
95              if (EcoreUtil.isAncestor(this, newDto))
96                  throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
97              NotificationChain msgs = null;
98              if (eInternalContainer() != null)
99                  msgs = eBasicRemoveFromContainer(msgs);
100             if (newDto != null)
101                 msgs = ((InternalEObject)newDto).eInverseAdd(this, DataContractDslPackage.BUSINESS_CLASS_DTO__ASSOCIATION_REFERENCES, BusinessClassDto.class, msgs);
102             msgs = basicSetDto(newDto, msgs);
103             if (msgs != null) msgs.dispatch();
104         }
105         else if (eNotificationRequired())
106             eNotify(new ENotificationImpl(this, Notification.SET, DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO, newDto, newDto));
107     }
108 
109 	/**
110      * <!-- begin-user-doc -->
111 	 * <!-- end-user-doc -->
112      * @generated
113      */
114 	public Dto getDtoType() {
115         if (dtoType != null && dtoType.eIsProxy()) {
116             InternalEObject oldDtoType = (InternalEObject)dtoType;
117             dtoType = (Dto)eResolveProxy(oldDtoType);
118             if (dtoType != oldDtoType) {
119                 if (eNotificationRequired())
120                     eNotify(new ENotificationImpl(this, Notification.RESOLVE, DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO_TYPE, oldDtoType, dtoType));
121             }
122         }
123         return dtoType;
124     }
125 
126 	/**
127      * <!-- begin-user-doc -->
128 	 * <!-- end-user-doc -->
129      * @generated
130      */
131 	public Dto basicGetDtoType() {
132         return dtoType;
133     }
134 
135 	/**
136      * <!-- begin-user-doc -->
137 	 * <!-- end-user-doc -->
138      * @generated
139      */
140 	public void setDtoType(Dto newDtoType) {
141         Dto oldDtoType = dtoType;
142         dtoType = newDtoType;
143         if (eNotificationRequired())
144             eNotify(new ENotificationImpl(this, Notification.SET, DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO_TYPE, oldDtoType, dtoType));
145     }
146 
147 	/**
148      * <!-- begin-user-doc -->
149 	 * <!-- end-user-doc -->
150      * @generated
151      */
152 	@Override
153 	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
154         switch (featureID) {
155             case DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO:
156                 if (eInternalContainer() != null)
157                     msgs = eBasicRemoveFromContainer(msgs);
158                 return basicSetDto((BusinessClassDto)otherEnd, msgs);
159         }
160         return super.eInverseAdd(otherEnd, featureID, msgs);
161     }
162 
163 	/**
164      * <!-- begin-user-doc -->
165 	 * <!-- end-user-doc -->
166      * @generated
167      */
168 	@Override
169 	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
170         switch (featureID) {
171             case DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO:
172                 return basicSetDto(null, msgs);
173         }
174         return super.eInverseRemove(otherEnd, featureID, msgs);
175     }
176 
177 	/**
178      * <!-- begin-user-doc -->
179 	 * <!-- end-user-doc -->
180      * @generated
181      */
182 	@Override
183 	public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
184         switch (eContainerFeatureID()) {
185             case DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO:
186                 return eInternalContainer().eInverseRemove(this, DataContractDslPackage.BUSINESS_CLASS_DTO__ASSOCIATION_REFERENCES, BusinessClassDto.class, msgs);
187         }
188         return super.eBasicRemoveFromContainerFeature(msgs);
189     }
190 
191 	/**
192      * <!-- begin-user-doc -->
193 	 * <!-- end-user-doc -->
194      * @generated
195      */
196 	@Override
197 	public Object eGet(int featureID, boolean resolve, boolean coreType) {
198         switch (featureID) {
199             case DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO:
200                 return getDto();
201             case DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO_TYPE:
202                 if (resolve) return getDtoType();
203                 return basicGetDtoType();
204         }
205         return super.eGet(featureID, resolve, coreType);
206     }
207 
208 	/**
209      * <!-- begin-user-doc -->
210 	 * <!-- end-user-doc -->
211      * @generated
212      */
213 	@Override
214 	public void eSet(int featureID, Object newValue) {
215         switch (featureID) {
216             case DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO:
217                 setDto((BusinessClassDto)newValue);
218                 return;
219             case DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO_TYPE:
220                 setDtoType((Dto)newValue);
221                 return;
222         }
223         super.eSet(featureID, newValue);
224     }
225 
226 	/**
227      * <!-- begin-user-doc -->
228 	 * <!-- end-user-doc -->
229      * @generated
230      */
231 	@Override
232 	public void eUnset(int featureID) {
233         switch (featureID) {
234             case DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO:
235                 setDto((BusinessClassDto)null);
236                 return;
237             case DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO_TYPE:
238                 setDtoType((Dto)null);
239                 return;
240         }
241         super.eUnset(featureID);
242     }
243 
244 	/**
245      * <!-- begin-user-doc -->
246 	 * <!-- end-user-doc -->
247      * @generated
248      */
249 	@Override
250 	public boolean eIsSet(int featureID) {
251         switch (featureID) {
252             case DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO:
253                 return getDto() != null;
254             case DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO_TYPE:
255                 return dtoType != null;
256         }
257         return super.eIsSet(featureID);
258     }
259 
260 } //BusinessClassAssociationRoleReferenceImpl