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.DtoEnumerationProperty;
18  import org.mod4j.dsl.datacontract.mm.DataContractDsl.EnumerationDto;
19  
20  /**
21   * <!-- begin-user-doc -->
22   * An implementation of the model object '<em><b>Dto Enumeration Property</b></em>'.
23   * <!-- end-user-doc -->
24   * <p>
25   * The following features are implemented:
26   * <ul>
27   *   <li>{@link org.mod4j.dsl.datacontract.mm.DataContractDsl.impl.DtoEnumerationPropertyImpl#getType <em>Type</em>}</li>
28   *   <li>{@link org.mod4j.dsl.datacontract.mm.DataContractDsl.impl.DtoEnumerationPropertyImpl#getDefaultValueAsString <em>Default Value As String</em>}</li>
29   * </ul>
30   * </p>
31   *
32   * @generated
33   */
34  public class DtoEnumerationPropertyImpl extends DtoDataPropertyImpl implements DtoEnumerationProperty {
35  	/**
36       * The cached value of the '{@link #getType() <em>Type</em>}' reference.
37       * <!-- begin-user-doc -->
38  	 * <!-- end-user-doc -->
39       * @see #getType()
40       * @generated
41       * @ordered
42       */
43  	protected EnumerationDto type;
44  
45  	/**
46       * The default value of the '{@link #getDefaultValueAsString() <em>Default Value As String</em>}' attribute.
47       * <!-- begin-user-doc -->
48       * <!-- end-user-doc -->
49       * @see #getDefaultValueAsString()
50       * @generated
51       * @ordered
52       */
53      protected static final String DEFAULT_VALUE_AS_STRING_EDEFAULT = null;
54      /**
55       * The cached value of the '{@link #getDefaultValueAsString() <em>Default Value As String</em>}' attribute.
56       * <!-- begin-user-doc -->
57       * <!-- end-user-doc -->
58       * @see #getDefaultValueAsString()
59       * @generated
60       * @ordered
61       */
62      protected String defaultValueAsString = DEFAULT_VALUE_AS_STRING_EDEFAULT;
63  
64      /**
65       * <!-- begin-user-doc -->
66  	 * <!-- end-user-doc -->
67       * @generated
68       */
69  	protected DtoEnumerationPropertyImpl() {
70          super();
71      }
72  
73  	/**
74       * <!-- begin-user-doc -->
75  	 * <!-- end-user-doc -->
76       * @generated
77       */
78  	@Override
79  	protected EClass eStaticClass() {
80          return DataContractDslPackage.Literals.DTO_ENUMERATION_PROPERTY;
81      }
82  
83  	/**
84       * <!-- begin-user-doc -->
85  	 * <!-- end-user-doc -->
86       * @generated
87       */
88  	public EnumerationDto getType() {
89          if (type != null && type.eIsProxy()) {
90              InternalEObject oldType = (InternalEObject)type;
91              type = (EnumerationDto)eResolveProxy(oldType);
92              if (type != oldType) {
93                  if (eNotificationRequired())
94                      eNotify(new ENotificationImpl(this, Notification.RESOLVE, DataContractDslPackage.DTO_ENUMERATION_PROPERTY__TYPE, oldType, type));
95              }
96          }
97          return type;
98      }
99  
100 	/**
101      * <!-- begin-user-doc -->
102 	 * <!-- end-user-doc -->
103      * @generated
104      */
105 	public EnumerationDto basicGetType() {
106         return type;
107     }
108 
109 	/**
110      * <!-- begin-user-doc -->
111 	 * <!-- end-user-doc -->
112      * @generated
113      */
114 	public void setType(EnumerationDto newType) {
115         EnumerationDto oldType = type;
116         type = newType;
117         if (eNotificationRequired())
118             eNotify(new ENotificationImpl(this, Notification.SET, DataContractDslPackage.DTO_ENUMERATION_PROPERTY__TYPE, oldType, type));
119     }
120 
121 	/**
122      * <!-- begin-user-doc -->
123      * <!-- end-user-doc -->
124      * @generated
125      */
126     public String getDefaultValueAsString() {
127         return defaultValueAsString;
128     }
129 
130     /**
131      * <!-- begin-user-doc -->
132      * <!-- end-user-doc -->
133      * @generated
134      */
135     public void setDefaultValueAsString(String newDefaultValueAsString) {
136         String oldDefaultValueAsString = defaultValueAsString;
137         defaultValueAsString = newDefaultValueAsString;
138         if (eNotificationRequired())
139             eNotify(new ENotificationImpl(this, Notification.SET, DataContractDslPackage.DTO_ENUMERATION_PROPERTY__DEFAULT_VALUE_AS_STRING, oldDefaultValueAsString, defaultValueAsString));
140     }
141 
142     /**
143      * <!-- begin-user-doc -->
144 	 * <!-- end-user-doc -->
145      * @generated
146      */
147 	@Override
148 	public Object eGet(int featureID, boolean resolve, boolean coreType) {
149         switch (featureID) {
150             case DataContractDslPackage.DTO_ENUMERATION_PROPERTY__TYPE:
151                 if (resolve) return getType();
152                 return basicGetType();
153             case DataContractDslPackage.DTO_ENUMERATION_PROPERTY__DEFAULT_VALUE_AS_STRING:
154                 return getDefaultValueAsString();
155         }
156         return super.eGet(featureID, resolve, coreType);
157     }
158 
159 	/**
160      * <!-- begin-user-doc -->
161 	 * <!-- end-user-doc -->
162      * @generated
163      */
164 	@Override
165 	public void eSet(int featureID, Object newValue) {
166         switch (featureID) {
167             case DataContractDslPackage.DTO_ENUMERATION_PROPERTY__TYPE:
168                 setType((EnumerationDto)newValue);
169                 return;
170             case DataContractDslPackage.DTO_ENUMERATION_PROPERTY__DEFAULT_VALUE_AS_STRING:
171                 setDefaultValueAsString((String)newValue);
172                 return;
173         }
174         super.eSet(featureID, newValue);
175     }
176 
177 	/**
178      * <!-- begin-user-doc -->
179 	 * <!-- end-user-doc -->
180      * @generated
181      */
182 	@Override
183 	public void eUnset(int featureID) {
184         switch (featureID) {
185             case DataContractDslPackage.DTO_ENUMERATION_PROPERTY__TYPE:
186                 setType((EnumerationDto)null);
187                 return;
188             case DataContractDslPackage.DTO_ENUMERATION_PROPERTY__DEFAULT_VALUE_AS_STRING:
189                 setDefaultValueAsString(DEFAULT_VALUE_AS_STRING_EDEFAULT);
190                 return;
191         }
192         super.eUnset(featureID);
193     }
194 
195 	/**
196      * <!-- begin-user-doc -->
197 	 * <!-- end-user-doc -->
198      * @generated
199      */
200 	@Override
201 	public boolean eIsSet(int featureID) {
202         switch (featureID) {
203             case DataContractDslPackage.DTO_ENUMERATION_PROPERTY__TYPE:
204                 return type != null;
205             case DataContractDslPackage.DTO_ENUMERATION_PROPERTY__DEFAULT_VALUE_AS_STRING:
206                 return DEFAULT_VALUE_AS_STRING_EDEFAULT == null ? defaultValueAsString != null : !DEFAULT_VALUE_AS_STRING_EDEFAULT.equals(defaultValueAsString);
207         }
208         return super.eIsSet(featureID);
209     }
210 
211     /**
212      * <!-- begin-user-doc -->
213      * <!-- end-user-doc -->
214      * @generated
215      */
216     @Override
217     public String toString() {
218         if (eIsProxy()) return super.toString();
219 
220         StringBuffer result = new StringBuffer(super.toString());
221         result.append(" (defaultValueAsString: ");
222         result.append(defaultValueAsString);
223         result.append(')');
224         return result.toString();
225     }
226 
227 } //DtoEnumerationPropertyImpl