View Javadoc

1   /**
2    * <copyright>
3    * </copyright>
4    *
5    * $Id$
6    */
7   package org.mod4j.dsl.datacontract.mm.DataContractDsl.impl;
8   
9   import java.util.Collection;
10  
11  import org.eclipse.emf.common.notify.Notification;
12  import org.eclipse.emf.common.notify.NotificationChain;
13  
14  import org.eclipse.emf.common.util.EList;
15  
16  import org.eclipse.emf.ecore.EClass;
17  import org.eclipse.emf.ecore.InternalEObject;
18  
19  import org.eclipse.emf.ecore.impl.ENotificationImpl;
20  
21  import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
22  import org.eclipse.emf.ecore.util.InternalEList;
23  
24  import org.mod4j.dsl.datacontract.mm.DataContractDsl.BusinessClassAssociationRoleReference;
25  import org.mod4j.dsl.datacontract.mm.DataContractDsl.BusinessClassDto;
26  import org.mod4j.dsl.datacontract.mm.DataContractDsl.BusinessClassPropertyReference;
27  import org.mod4j.dsl.datacontract.mm.DataContractDsl.DataContractDslPackage;
28  import org.mod4j.dsl.datacontract.mm.DataContractDsl.DtoProperty;
29  import org.mod4j.dsl.datacontract.mm.DataContractDsl.ExternalReference;
30  
31  /**
32   * <!-- begin-user-doc -->
33   * An implementation of the model object '<em><b>Business Class Dto</b></em>'.
34   * <!-- end-user-doc -->
35   * <p>
36   * The following features are implemented:
37   * <ul>
38   *   <li>{@link org.mod4j.dsl.datacontract.mm.DataContractDsl.impl.BusinessClassDtoImpl#getProperties <em>Properties</em>}</li>
39   *   <li>{@link org.mod4j.dsl.datacontract.mm.DataContractDsl.impl.BusinessClassDtoImpl#getBase <em>Base</em>}</li>
40   *   <li>{@link org.mod4j.dsl.datacontract.mm.DataContractDsl.impl.BusinessClassDtoImpl#getPropertyReferences <em>Property References</em>}</li>
41   *   <li>{@link org.mod4j.dsl.datacontract.mm.DataContractDsl.impl.BusinessClassDtoImpl#getAssociationReferences <em>Association References</em>}</li>
42   *   <li>{@link org.mod4j.dsl.datacontract.mm.DataContractDsl.impl.BusinessClassDtoImpl#isCreatable <em>Creatable</em>}</li>
43   * </ul>
44   * </p>
45   *
46   * @generated
47   */
48  public class BusinessClassDtoImpl extends DtoImpl implements BusinessClassDto {
49  	/**
50       * The cached value of the '{@link #getProperties() <em>Properties</em>}' containment reference list.
51       * <!-- begin-user-doc -->
52  	 * <!-- end-user-doc -->
53       * @see #getProperties()
54       * @generated
55       * @ordered
56       */
57  	protected EList<DtoProperty> properties;
58  
59  	/**
60       * The cached value of the '{@link #getBase() <em>Base</em>}' reference.
61       * <!-- begin-user-doc -->
62  	 * <!-- end-user-doc -->
63       * @see #getBase()
64       * @generated
65       * @ordered
66       */
67  	protected ExternalReference base;
68  
69  	/**
70       * The cached value of the '{@link #getPropertyReferences() <em>Property References</em>}' containment reference list.
71       * <!-- begin-user-doc -->
72  	 * <!-- end-user-doc -->
73       * @see #getPropertyReferences()
74       * @generated
75       * @ordered
76       */
77  	protected EList<BusinessClassPropertyReference> propertyReferences;
78  
79  	/**
80       * The cached value of the '{@link #getAssociationReferences() <em>Association References</em>}' containment reference list.
81       * <!-- begin-user-doc -->
82  	 * <!-- end-user-doc -->
83       * @see #getAssociationReferences()
84       * @generated
85       * @ordered
86       */
87  	protected EList<BusinessClassAssociationRoleReference> associationReferences;
88  
89  	/**
90       * The default value of the '{@link #isCreatable() <em>Creatable</em>}' attribute.
91       * <!-- begin-user-doc -->
92  	 * <!-- end-user-doc -->
93       * @see #isCreatable()
94       * @generated
95       * @ordered
96       */
97  	protected static final boolean CREATABLE_EDEFAULT = false;
98  
99  	/**
100      * The cached value of the '{@link #isCreatable() <em>Creatable</em>}' attribute.
101      * <!-- begin-user-doc -->
102 	 * <!-- end-user-doc -->
103      * @see #isCreatable()
104      * @generated
105      * @ordered
106      */
107 	protected boolean creatable = CREATABLE_EDEFAULT;
108 
109 	/**
110      * <!-- begin-user-doc -->
111 	 * <!-- end-user-doc -->
112      * @generated
113      */
114 	protected BusinessClassDtoImpl() {
115         super();
116     }
117 
118 	/**
119      * <!-- begin-user-doc -->
120 	 * <!-- end-user-doc -->
121      * @generated
122      */
123 	@Override
124 	protected EClass eStaticClass() {
125         return DataContractDslPackage.Literals.BUSINESS_CLASS_DTO;
126     }
127 
128 	/**
129      * <!-- begin-user-doc -->
130 	 * <!-- end-user-doc -->
131      * @generated
132      */
133 	public EList<DtoProperty> getProperties() {
134         if (properties == null) {
135             properties = new EObjectContainmentWithInverseEList<DtoProperty>(DtoProperty.class, this, DataContractDslPackage.BUSINESS_CLASS_DTO__PROPERTIES, DataContractDslPackage.DTO_PROPERTY__BUSINESS_CLASS_DTO);
136         }
137         return properties;
138     }
139 
140 	/**
141      * <!-- begin-user-doc -->
142 	 * <!-- end-user-doc -->
143      * @generated
144      */
145 	public ExternalReference getBase() {
146         if (base != null && base.eIsProxy()) {
147             InternalEObject oldBase = (InternalEObject)base;
148             base = (ExternalReference)eResolveProxy(oldBase);
149             if (base != oldBase) {
150                 if (eNotificationRequired())
151                     eNotify(new ENotificationImpl(this, Notification.RESOLVE, DataContractDslPackage.BUSINESS_CLASS_DTO__BASE, oldBase, base));
152             }
153         }
154         return base;
155     }
156 
157 	/**
158      * <!-- begin-user-doc -->
159 	 * <!-- end-user-doc -->
160      * @generated
161      */
162 	public ExternalReference basicGetBase() {
163         return base;
164     }
165 
166 	/**
167      * <!-- begin-user-doc -->
168 	 * <!-- end-user-doc -->
169      * @generated
170      */
171 	public void setBase(ExternalReference newBase) {
172         ExternalReference oldBase = base;
173         base = newBase;
174         if (eNotificationRequired())
175             eNotify(new ENotificationImpl(this, Notification.SET, DataContractDslPackage.BUSINESS_CLASS_DTO__BASE, oldBase, base));
176     }
177 
178 	/**
179      * <!-- begin-user-doc -->
180 	 * <!-- end-user-doc -->
181      * @generated
182      */
183 	public EList<BusinessClassPropertyReference> getPropertyReferences() {
184         if (propertyReferences == null) {
185             propertyReferences = new EObjectContainmentWithInverseEList<BusinessClassPropertyReference>(BusinessClassPropertyReference.class, this, DataContractDslPackage.BUSINESS_CLASS_DTO__PROPERTY_REFERENCES, DataContractDslPackage.BUSINESS_CLASS_PROPERTY_REFERENCE__DTO);
186         }
187         return propertyReferences;
188     }
189 
190 	/**
191      * <!-- begin-user-doc -->
192 	 * <!-- end-user-doc -->
193      * @generated
194      */
195 	public EList<BusinessClassAssociationRoleReference> getAssociationReferences() {
196         if (associationReferences == null) {
197             associationReferences = new EObjectContainmentWithInverseEList<BusinessClassAssociationRoleReference>(BusinessClassAssociationRoleReference.class, this, DataContractDslPackage.BUSINESS_CLASS_DTO__ASSOCIATION_REFERENCES, DataContractDslPackage.BUSINESS_CLASS_ASSOCIATION_ROLE_REFERENCE__DTO);
198         }
199         return associationReferences;
200     }
201 
202 	/**
203      * <!-- begin-user-doc -->
204 	 * <!-- end-user-doc -->
205      * @generated
206      */
207 	public boolean isCreatable() {
208         return creatable;
209     }
210 
211 	/**
212      * <!-- begin-user-doc -->
213 	 * <!-- end-user-doc -->
214      * @generated
215      */
216 	public void setCreatable(boolean newCreatable) {
217         boolean oldCreatable = creatable;
218         creatable = newCreatable;
219         if (eNotificationRequired())
220             eNotify(new ENotificationImpl(this, Notification.SET, DataContractDslPackage.BUSINESS_CLASS_DTO__CREATABLE, oldCreatable, creatable));
221     }
222 
223 	/**
224      * <!-- begin-user-doc -->
225 	 * <!-- end-user-doc -->
226      * @generated
227      */
228 	@SuppressWarnings("unchecked")
229 	@Override
230 	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
231         switch (featureID) {
232             case DataContractDslPackage.BUSINESS_CLASS_DTO__PROPERTIES:
233                 return ((InternalEList<InternalEObject>)(InternalEList<?>)getProperties()).basicAdd(otherEnd, msgs);
234             case DataContractDslPackage.BUSINESS_CLASS_DTO__PROPERTY_REFERENCES:
235                 return ((InternalEList<InternalEObject>)(InternalEList<?>)getPropertyReferences()).basicAdd(otherEnd, msgs);
236             case DataContractDslPackage.BUSINESS_CLASS_DTO__ASSOCIATION_REFERENCES:
237                 return ((InternalEList<InternalEObject>)(InternalEList<?>)getAssociationReferences()).basicAdd(otherEnd, msgs);
238         }
239         return super.eInverseAdd(otherEnd, featureID, msgs);
240     }
241 
242 	/**
243      * <!-- begin-user-doc -->
244 	 * <!-- end-user-doc -->
245      * @generated
246      */
247 	@Override
248 	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
249         switch (featureID) {
250             case DataContractDslPackage.BUSINESS_CLASS_DTO__PROPERTIES:
251                 return ((InternalEList<?>)getProperties()).basicRemove(otherEnd, msgs);
252             case DataContractDslPackage.BUSINESS_CLASS_DTO__PROPERTY_REFERENCES:
253                 return ((InternalEList<?>)getPropertyReferences()).basicRemove(otherEnd, msgs);
254             case DataContractDslPackage.BUSINESS_CLASS_DTO__ASSOCIATION_REFERENCES:
255                 return ((InternalEList<?>)getAssociationReferences()).basicRemove(otherEnd, msgs);
256         }
257         return super.eInverseRemove(otherEnd, featureID, msgs);
258     }
259 
260 	/**
261      * <!-- begin-user-doc -->
262 	 * <!-- end-user-doc -->
263      * @generated
264      */
265 	@Override
266 	public Object eGet(int featureID, boolean resolve, boolean coreType) {
267         switch (featureID) {
268             case DataContractDslPackage.BUSINESS_CLASS_DTO__PROPERTIES:
269                 return getProperties();
270             case DataContractDslPackage.BUSINESS_CLASS_DTO__BASE:
271                 if (resolve) return getBase();
272                 return basicGetBase();
273             case DataContractDslPackage.BUSINESS_CLASS_DTO__PROPERTY_REFERENCES:
274                 return getPropertyReferences();
275             case DataContractDslPackage.BUSINESS_CLASS_DTO__ASSOCIATION_REFERENCES:
276                 return getAssociationReferences();
277             case DataContractDslPackage.BUSINESS_CLASS_DTO__CREATABLE:
278                 return isCreatable();
279         }
280         return super.eGet(featureID, resolve, coreType);
281     }
282 
283 	/**
284      * <!-- begin-user-doc -->
285 	 * <!-- end-user-doc -->
286      * @generated
287      */
288 	@SuppressWarnings("unchecked")
289 	@Override
290 	public void eSet(int featureID, Object newValue) {
291         switch (featureID) {
292             case DataContractDslPackage.BUSINESS_CLASS_DTO__PROPERTIES:
293                 getProperties().clear();
294                 getProperties().addAll((Collection<? extends DtoProperty>)newValue);
295                 return;
296             case DataContractDslPackage.BUSINESS_CLASS_DTO__BASE:
297                 setBase((ExternalReference)newValue);
298                 return;
299             case DataContractDslPackage.BUSINESS_CLASS_DTO__PROPERTY_REFERENCES:
300                 getPropertyReferences().clear();
301                 getPropertyReferences().addAll((Collection<? extends BusinessClassPropertyReference>)newValue);
302                 return;
303             case DataContractDslPackage.BUSINESS_CLASS_DTO__ASSOCIATION_REFERENCES:
304                 getAssociationReferences().clear();
305                 getAssociationReferences().addAll((Collection<? extends BusinessClassAssociationRoleReference>)newValue);
306                 return;
307             case DataContractDslPackage.BUSINESS_CLASS_DTO__CREATABLE:
308                 setCreatable((Boolean)newValue);
309                 return;
310         }
311         super.eSet(featureID, newValue);
312     }
313 
314 	/**
315      * <!-- begin-user-doc -->
316 	 * <!-- end-user-doc -->
317      * @generated
318      */
319 	@Override
320 	public void eUnset(int featureID) {
321         switch (featureID) {
322             case DataContractDslPackage.BUSINESS_CLASS_DTO__PROPERTIES:
323                 getProperties().clear();
324                 return;
325             case DataContractDslPackage.BUSINESS_CLASS_DTO__BASE:
326                 setBase((ExternalReference)null);
327                 return;
328             case DataContractDslPackage.BUSINESS_CLASS_DTO__PROPERTY_REFERENCES:
329                 getPropertyReferences().clear();
330                 return;
331             case DataContractDslPackage.BUSINESS_CLASS_DTO__ASSOCIATION_REFERENCES:
332                 getAssociationReferences().clear();
333                 return;
334             case DataContractDslPackage.BUSINESS_CLASS_DTO__CREATABLE:
335                 setCreatable(CREATABLE_EDEFAULT);
336                 return;
337         }
338         super.eUnset(featureID);
339     }
340 
341 	/**
342      * <!-- begin-user-doc -->
343 	 * <!-- end-user-doc -->
344      * @generated
345      */
346 	@Override
347 	public boolean eIsSet(int featureID) {
348         switch (featureID) {
349             case DataContractDslPackage.BUSINESS_CLASS_DTO__PROPERTIES:
350                 return properties != null && !properties.isEmpty();
351             case DataContractDslPackage.BUSINESS_CLASS_DTO__BASE:
352                 return base != null;
353             case DataContractDslPackage.BUSINESS_CLASS_DTO__PROPERTY_REFERENCES:
354                 return propertyReferences != null && !propertyReferences.isEmpty();
355             case DataContractDslPackage.BUSINESS_CLASS_DTO__ASSOCIATION_REFERENCES:
356                 return associationReferences != null && !associationReferences.isEmpty();
357             case DataContractDslPackage.BUSINESS_CLASS_DTO__CREATABLE:
358                 return creatable != CREATABLE_EDEFAULT;
359         }
360         return super.eIsSet(featureID);
361     }
362 
363 	/**
364      * <!-- begin-user-doc -->
365 	 * <!-- end-user-doc -->
366      * @generated
367      */
368 	@Override
369 	public String toString() {
370         if (eIsProxy()) return super.toString();
371 
372         StringBuffer result = new StringBuffer(super.toString());
373         result.append(" (creatable: ");
374         result.append(creatable);
375         result.append(')');
376         return result.toString();
377     }
378 
379 } //BusinessClassDtoImpl