View Javadoc

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