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  
11  import org.eclipse.emf.ecore.EClass;
12  import org.eclipse.emf.ecore.InternalEObject;
13  
14  import org.eclipse.emf.ecore.impl.ENotificationImpl;
15  
16  import org.mod4j.dsl.datacontract.mm.DataContractDsl.DataContractDslPackage;
17  import org.mod4j.dsl.datacontract.mm.DataContractDsl.Dto;
18  import org.mod4j.dsl.datacontract.mm.DataContractDsl.DtoAssociationRoleProperty;
19  import org.mod4j.dsl.datacontract.mm.DataContractDsl.Multiplicity;
20  
21  /**
22   * <!-- begin-user-doc -->
23   * An implementation of the model object '<em><b>Dto Association Role Property</b></em>'.
24   * <!-- end-user-doc -->
25   * <p>
26   * The following features are implemented:
27   * <ul>
28   *   <li>{@link org.mod4j.dsl.datacontract.mm.DataContractDsl.impl.DtoAssociationRolePropertyImpl#getDtoType <em>Dto Type</em>}</li>
29   *   <li>{@link org.mod4j.dsl.datacontract.mm.DataContractDsl.impl.DtoAssociationRolePropertyImpl#isOrdered <em>Ordered</em>}</li>
30   *   <li>{@link org.mod4j.dsl.datacontract.mm.DataContractDsl.impl.DtoAssociationRolePropertyImpl#getMultiplicity <em>Multiplicity</em>}</li>
31   * </ul>
32   * </p>
33   *
34   * @generated
35   */
36  public class DtoAssociationRolePropertyImpl extends DtoPropertyImpl implements DtoAssociationRoleProperty {
37  	/**
38       * The cached value of the '{@link #getDtoType() <em>Dto Type</em>}' reference.
39       * <!-- begin-user-doc -->
40  	 * <!-- end-user-doc -->
41       * @see #getDtoType()
42       * @generated
43       * @ordered
44       */
45  	protected Dto dtoType;
46  
47  	/**
48       * The default value of the '{@link #isOrdered() <em>Ordered</em>}' attribute.
49       * <!-- begin-user-doc -->
50  	 * <!-- end-user-doc -->
51       * @see #isOrdered()
52       * @generated
53       * @ordered
54       */
55  	protected static final boolean ORDERED_EDEFAULT = false;
56  
57  	/**
58       * The cached value of the '{@link #isOrdered() <em>Ordered</em>}' attribute.
59       * <!-- begin-user-doc -->
60  	 * <!-- end-user-doc -->
61       * @see #isOrdered()
62       * @generated
63       * @ordered
64       */
65  	protected boolean ordered = ORDERED_EDEFAULT;
66  
67  	/**
68       * The default value of the '{@link #getMultiplicity() <em>Multiplicity</em>}' attribute.
69       * <!-- begin-user-doc -->
70       * <!-- end-user-doc -->
71       * @see #getMultiplicity()
72       * @generated
73       * @ordered
74       */
75      protected static final Multiplicity MULTIPLICITY_EDEFAULT = Multiplicity.ONE;
76  
77      /**
78       * The cached value of the '{@link #getMultiplicity() <em>Multiplicity</em>}' attribute.
79       * <!-- begin-user-doc -->
80       * <!-- end-user-doc -->
81       * @see #getMultiplicity()
82       * @generated
83       * @ordered
84       */
85      protected Multiplicity multiplicity = MULTIPLICITY_EDEFAULT;
86  
87      /**
88       * <!-- begin-user-doc -->
89  	 * <!-- end-user-doc -->
90       * @generated
91       */
92  	protected DtoAssociationRolePropertyImpl() {
93          super();
94      }
95  
96  	/**
97       * <!-- begin-user-doc -->
98  	 * <!-- end-user-doc -->
99       * @generated
100      */
101 	@Override
102 	protected EClass eStaticClass() {
103         return DataContractDslPackage.Literals.DTO_ASSOCIATION_ROLE_PROPERTY;
104     }
105 
106 	/**
107      * <!-- begin-user-doc -->
108 	 * <!-- end-user-doc -->
109      * @generated
110      */
111 	public Dto getDtoType() {
112         if (dtoType != null && dtoType.eIsProxy()) {
113             InternalEObject oldDtoType = (InternalEObject)dtoType;
114             dtoType = (Dto)eResolveProxy(oldDtoType);
115             if (dtoType != oldDtoType) {
116                 if (eNotificationRequired())
117                     eNotify(new ENotificationImpl(this, Notification.RESOLVE, DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__DTO_TYPE, oldDtoType, dtoType));
118             }
119         }
120         return dtoType;
121     }
122 
123 	/**
124      * <!-- begin-user-doc -->
125 	 * <!-- end-user-doc -->
126      * @generated
127      */
128 	public Dto basicGetDtoType() {
129         return dtoType;
130     }
131 
132 	/**
133      * <!-- begin-user-doc -->
134 	 * <!-- end-user-doc -->
135      * @generated
136      */
137 	public void setDtoType(Dto newDtoType) {
138         Dto oldDtoType = dtoType;
139         dtoType = newDtoType;
140         if (eNotificationRequired())
141             eNotify(new ENotificationImpl(this, Notification.SET, DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__DTO_TYPE, oldDtoType, dtoType));
142     }
143 
144 	/**
145      * <!-- begin-user-doc -->
146 	 * <!-- end-user-doc -->
147      * @generated
148      */
149 	public boolean isOrdered() {
150         return ordered;
151     }
152 
153 	/**
154      * <!-- begin-user-doc -->
155 	 * <!-- end-user-doc -->
156      * @generated
157      */
158 	public void setOrdered(boolean newOrdered) {
159         boolean oldOrdered = ordered;
160         ordered = newOrdered;
161         if (eNotificationRequired())
162             eNotify(new ENotificationImpl(this, Notification.SET, DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__ORDERED, oldOrdered, ordered));
163     }
164 
165 	/**
166      * <!-- begin-user-doc -->
167      * <!-- end-user-doc -->
168      * @generated
169      */
170     public Multiplicity getMultiplicity() {
171         return multiplicity;
172     }
173 
174     /**
175      * <!-- begin-user-doc -->
176      * <!-- end-user-doc -->
177      * @generated
178      */
179     public void setMultiplicity(Multiplicity newMultiplicity) {
180         Multiplicity oldMultiplicity = multiplicity;
181         multiplicity = newMultiplicity == null ? MULTIPLICITY_EDEFAULT : newMultiplicity;
182         if (eNotificationRequired())
183             eNotify(new ENotificationImpl(this, Notification.SET, DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__MULTIPLICITY, oldMultiplicity, multiplicity));
184     }
185 
186     /**
187      * <!-- begin-user-doc -->
188 	 * <!-- end-user-doc -->
189      * @generated
190      */
191 	@Override
192 	public Object eGet(int featureID, boolean resolve, boolean coreType) {
193         switch (featureID) {
194             case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__DTO_TYPE:
195                 if (resolve) return getDtoType();
196                 return basicGetDtoType();
197             case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__ORDERED:
198                 return isOrdered();
199             case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__MULTIPLICITY:
200                 return getMultiplicity();
201         }
202         return super.eGet(featureID, resolve, coreType);
203     }
204 
205 	/**
206      * <!-- begin-user-doc -->
207 	 * <!-- end-user-doc -->
208      * @generated
209      */
210 	@Override
211 	public void eSet(int featureID, Object newValue) {
212         switch (featureID) {
213             case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__DTO_TYPE:
214                 setDtoType((Dto)newValue);
215                 return;
216             case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__ORDERED:
217                 setOrdered((Boolean)newValue);
218                 return;
219             case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__MULTIPLICITY:
220                 setMultiplicity((Multiplicity)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.DTO_ASSOCIATION_ROLE_PROPERTY__DTO_TYPE:
235                 setDtoType((Dto)null);
236                 return;
237             case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__ORDERED:
238                 setOrdered(ORDERED_EDEFAULT);
239                 return;
240             case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__MULTIPLICITY:
241                 setMultiplicity(MULTIPLICITY_EDEFAULT);
242                 return;
243         }
244         super.eUnset(featureID);
245     }
246 
247 	/**
248      * <!-- begin-user-doc -->
249 	 * <!-- end-user-doc -->
250      * @generated
251      */
252 	@Override
253 	public boolean eIsSet(int featureID) {
254         switch (featureID) {
255             case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__DTO_TYPE:
256                 return dtoType != null;
257             case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__ORDERED:
258                 return ordered != ORDERED_EDEFAULT;
259             case DataContractDslPackage.DTO_ASSOCIATION_ROLE_PROPERTY__MULTIPLICITY:
260                 return multiplicity != MULTIPLICITY_EDEFAULT;
261         }
262         return super.eIsSet(featureID);
263     }
264 
265 	/**
266      * <!-- begin-user-doc -->
267 	 * <!-- end-user-doc -->
268      * @generated
269      */
270 	@Override
271 	public String toString() {
272         if (eIsProxy()) return super.toString();
273 
274         StringBuffer result = new StringBuffer(super.toString());
275         result.append(" (ordered: ");
276         result.append(ordered);
277         result.append(", multiplicity: ");
278         result.append(multiplicity);
279         result.append(')');
280         return result.toString();
281     }
282 
283 } //DtoAssociationRolePropertyImpl