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.DataContractDslPackage;
20  import org.mod4j.dsl.datacontract.mm.DataContractDsl.DataContractModel;
21  import org.mod4j.dsl.datacontract.mm.DataContractDsl.Dto;
22  
23  /**
24   * <!-- begin-user-doc -->
25   * An implementation of the model object '<em><b>Dto</b></em>'.
26   * <!-- end-user-doc -->
27   * <p>
28   * The following features are implemented:
29   * <ul>
30   *   <li>{@link org.mod4j.dsl.datacontract.mm.DataContractDsl.impl.DtoImpl#getDatacontractModel <em>Datacontract Model</em>}</li>
31   * </ul>
32   * </p>
33   *
34   * @generated
35   */
36  public class DtoImpl extends ModelElementImpl implements Dto {
37  	/**
38       * <!-- begin-user-doc -->
39  	 * <!-- end-user-doc -->
40       * @generated
41       */
42  	protected DtoImpl() {
43          super();
44      }
45  
46  	/**
47       * <!-- begin-user-doc -->
48  	 * <!-- end-user-doc -->
49       * @generated
50       */
51  	@Override
52  	protected EClass eStaticClass() {
53          return DataContractDslPackage.Literals.DTO;
54      }
55  
56  	/**
57       * <!-- begin-user-doc -->
58  	 * <!-- end-user-doc -->
59       * @generated
60       */
61  	public DataContractModel getDatacontractModel() {
62          if (eContainerFeatureID() != DataContractDslPackage.DTO__DATACONTRACT_MODEL) return null;
63          return (DataContractModel)eContainer();
64      }
65  
66  	/**
67       * <!-- begin-user-doc -->
68  	 * <!-- end-user-doc -->
69       * @generated
70       */
71  	public NotificationChain basicSetDatacontractModel(DataContractModel newDatacontractModel, NotificationChain msgs) {
72          msgs = eBasicSetContainer((InternalEObject)newDatacontractModel, DataContractDslPackage.DTO__DATACONTRACT_MODEL, msgs);
73          return msgs;
74      }
75  
76  	/**
77       * <!-- begin-user-doc -->
78  	 * <!-- end-user-doc -->
79       * @generated
80       */
81  	public void setDatacontractModel(DataContractModel newDatacontractModel) {
82          if (newDatacontractModel != eInternalContainer() || (eContainerFeatureID() != DataContractDslPackage.DTO__DATACONTRACT_MODEL && newDatacontractModel != null)) {
83              if (EcoreUtil.isAncestor(this, newDatacontractModel))
84                  throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
85              NotificationChain msgs = null;
86              if (eInternalContainer() != null)
87                  msgs = eBasicRemoveFromContainer(msgs);
88              if (newDatacontractModel != null)
89                  msgs = ((InternalEObject)newDatacontractModel).eInverseAdd(this, DataContractDslPackage.DATA_CONTRACT_MODEL__DTOS, DataContractModel.class, msgs);
90              msgs = basicSetDatacontractModel(newDatacontractModel, msgs);
91              if (msgs != null) msgs.dispatch();
92          }
93          else if (eNotificationRequired())
94              eNotify(new ENotificationImpl(this, Notification.SET, DataContractDslPackage.DTO__DATACONTRACT_MODEL, newDatacontractModel, newDatacontractModel));
95      }
96  
97  	/**
98       * <!-- begin-user-doc -->
99  	 * <!-- end-user-doc -->
100      * @generated
101      */
102 	@Override
103 	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
104         switch (featureID) {
105             case DataContractDslPackage.DTO__DATACONTRACT_MODEL:
106                 if (eInternalContainer() != null)
107                     msgs = eBasicRemoveFromContainer(msgs);
108                 return basicSetDatacontractModel((DataContractModel)otherEnd, msgs);
109         }
110         return super.eInverseAdd(otherEnd, featureID, msgs);
111     }
112 
113 	/**
114      * <!-- begin-user-doc -->
115 	 * <!-- end-user-doc -->
116      * @generated
117      */
118 	@Override
119 	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
120         switch (featureID) {
121             case DataContractDslPackage.DTO__DATACONTRACT_MODEL:
122                 return basicSetDatacontractModel(null, msgs);
123         }
124         return super.eInverseRemove(otherEnd, featureID, msgs);
125     }
126 
127 	/**
128      * <!-- begin-user-doc -->
129 	 * <!-- end-user-doc -->
130      * @generated
131      */
132 	@Override
133 	public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
134         switch (eContainerFeatureID()) {
135             case DataContractDslPackage.DTO__DATACONTRACT_MODEL:
136                 return eInternalContainer().eInverseRemove(this, DataContractDslPackage.DATA_CONTRACT_MODEL__DTOS, DataContractModel.class, msgs);
137         }
138         return super.eBasicRemoveFromContainerFeature(msgs);
139     }
140 
141 	/**
142      * <!-- begin-user-doc -->
143 	 * <!-- end-user-doc -->
144      * @generated
145      */
146 	@Override
147 	public Object eGet(int featureID, boolean resolve, boolean coreType) {
148         switch (featureID) {
149             case DataContractDslPackage.DTO__DATACONTRACT_MODEL:
150                 return getDatacontractModel();
151         }
152         return super.eGet(featureID, resolve, coreType);
153     }
154 
155 	/**
156      * <!-- begin-user-doc -->
157 	 * <!-- end-user-doc -->
158      * @generated
159      */
160 	@Override
161 	public void eSet(int featureID, Object newValue) {
162         switch (featureID) {
163             case DataContractDslPackage.DTO__DATACONTRACT_MODEL:
164                 setDatacontractModel((DataContractModel)newValue);
165                 return;
166         }
167         super.eSet(featureID, newValue);
168     }
169 
170 	/**
171      * <!-- begin-user-doc -->
172 	 * <!-- end-user-doc -->
173      * @generated
174      */
175 	@Override
176 	public void eUnset(int featureID) {
177         switch (featureID) {
178             case DataContractDslPackage.DTO__DATACONTRACT_MODEL:
179                 setDatacontractModel((DataContractModel)null);
180                 return;
181         }
182         super.eUnset(featureID);
183     }
184 
185 	/**
186      * <!-- begin-user-doc -->
187 	 * <!-- end-user-doc -->
188      * @generated
189      */
190 	@Override
191 	public boolean eIsSet(int featureID) {
192         switch (featureID) {
193             case DataContractDslPackage.DTO__DATACONTRACT_MODEL:
194                 return getDatacontractModel() != null;
195         }
196         return super.eIsSet(featureID);
197     }
198 
199 } //DtoImpl