View Javadoc

1   /**
2    * <copyright>
3    * </copyright>
4    *
5    * $Id$
6    */
7   package BusinessDomainDsl.impl;
8   
9   import BusinessDomainDsl.BusinessDomainDslPackage;
10  import BusinessDomainDsl.StringProperty;
11  
12  import org.eclipse.emf.common.notify.Notification;
13  
14  import org.eclipse.emf.ecore.EClass;
15  
16  import org.eclipse.emf.ecore.impl.ENotificationImpl;
17  
18  /**
19   * <!-- begin-user-doc -->
20   * An implementation of the model object '<em><b>String Property</b></em>'.
21   * <!-- end-user-doc -->
22   * <p>
23   * The following features are implemented:
24   * <ul>
25   *   <li>{@link BusinessDomainDsl.impl.StringPropertyImpl#getRegularExpression <em>Regular Expression</em>}</li>
26   *   <li>{@link BusinessDomainDsl.impl.StringPropertyImpl#getMinLength <em>Min Length</em>}</li>
27   *   <li>{@link BusinessDomainDsl.impl.StringPropertyImpl#getMaxLength <em>Max Length</em>}</li>
28   *   <li>{@link BusinessDomainDsl.impl.StringPropertyImpl#getDefaultValue <em>Default Value</em>}</li>
29   * </ul>
30   * </p>
31   *
32   * @generated
33   */
34  public class StringPropertyImpl extends PropertyImpl implements StringProperty {
35  	/**
36       * The default value of the '{@link #getRegularExpression() <em>Regular Expression</em>}' attribute.
37       * <!-- begin-user-doc -->
38  	 * <!-- end-user-doc -->
39       * @see #getRegularExpression()
40       * @generated
41       * @ordered
42       */
43  	protected static final String REGULAR_EXPRESSION_EDEFAULT = null;
44  
45  	/**
46       * The cached value of the '{@link #getRegularExpression() <em>Regular Expression</em>}' attribute.
47       * <!-- begin-user-doc -->
48  	 * <!-- end-user-doc -->
49       * @see #getRegularExpression()
50       * @generated
51       * @ordered
52       */
53  	protected String regularExpression = REGULAR_EXPRESSION_EDEFAULT;
54  
55  	/**
56       * The default value of the '{@link #getMinLength() <em>Min Length</em>}' attribute.
57       * <!-- begin-user-doc -->
58  	 * <!-- end-user-doc -->
59       * @see #getMinLength()
60       * @generated
61       * @ordered
62       */
63  	protected static final int MIN_LENGTH_EDEFAULT = -1;
64  
65  	/**
66       * The cached value of the '{@link #getMinLength() <em>Min Length</em>}' attribute.
67       * <!-- begin-user-doc -->
68  	 * <!-- end-user-doc -->
69       * @see #getMinLength()
70       * @generated
71       * @ordered
72       */
73  	protected int minLength = MIN_LENGTH_EDEFAULT;
74  
75  	/**
76       * The default value of the '{@link #getMaxLength() <em>Max Length</em>}' attribute.
77       * <!-- begin-user-doc -->
78  	 * <!-- end-user-doc -->
79       * @see #getMaxLength()
80       * @generated
81       * @ordered
82       */
83  	protected static final int MAX_LENGTH_EDEFAULT = -1;
84  
85  	/**
86       * The cached value of the '{@link #getMaxLength() <em>Max Length</em>}' attribute.
87       * <!-- begin-user-doc -->
88  	 * <!-- end-user-doc -->
89       * @see #getMaxLength()
90       * @generated
91       * @ordered
92       */
93  	protected int maxLength = MAX_LENGTH_EDEFAULT;
94  
95  	/**
96       * The default value of the '{@link #getDefaultValue() <em>Default Value</em>}' attribute.
97       * <!-- begin-user-doc -->
98  	 * <!-- end-user-doc -->
99       * @see #getDefaultValue()
100      * @generated
101      * @ordered
102      */
103 	protected static final String DEFAULT_VALUE_EDEFAULT = null;
104 
105 	/**
106      * The cached value of the '{@link #getDefaultValue() <em>Default Value</em>}' attribute.
107      * <!-- begin-user-doc -->
108 	 * <!-- end-user-doc -->
109      * @see #getDefaultValue()
110      * @generated
111      * @ordered
112      */
113 	protected String defaultValue = DEFAULT_VALUE_EDEFAULT;
114 
115 	/**
116      * <!-- begin-user-doc -->
117 	 * <!-- end-user-doc -->
118      * @generated
119      */
120 	protected StringPropertyImpl() {
121         super();
122     }
123 
124 	/**
125      * <!-- begin-user-doc -->
126 	 * <!-- end-user-doc -->
127      * @generated
128      */
129 	@Override
130 	protected EClass eStaticClass() {
131         return BusinessDomainDslPackage.Literals.STRING_PROPERTY;
132     }
133 
134 	/**
135      * <!-- begin-user-doc -->
136 	 * <!-- end-user-doc -->
137      * @generated
138      */
139 	public String getRegularExpression() {
140         return regularExpression;
141     }
142 
143 	/**
144      * <!-- begin-user-doc -->
145 	 * <!-- end-user-doc -->
146      * @generated
147      */
148 	public void setRegularExpression(String newRegularExpression) {
149         String oldRegularExpression = regularExpression;
150         regularExpression = newRegularExpression;
151         if (eNotificationRequired())
152             eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.STRING_PROPERTY__REGULAR_EXPRESSION, oldRegularExpression, regularExpression));
153     }
154 
155 	/**
156      * <!-- begin-user-doc -->
157 	 * <!-- end-user-doc -->
158      * @generated
159      */
160 	public int getMinLength() {
161         return minLength;
162     }
163 
164 	/**
165      * <!-- begin-user-doc -->
166 	 * <!-- end-user-doc -->
167      * @generated
168      */
169 	public void setMinLength(int newMinLength) {
170         int oldMinLength = minLength;
171         minLength = newMinLength;
172         if (eNotificationRequired())
173             eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.STRING_PROPERTY__MIN_LENGTH, oldMinLength, minLength));
174     }
175 
176 	/**
177      * <!-- begin-user-doc -->
178 	 * <!-- end-user-doc -->
179      * @generated
180      */
181 	public int getMaxLength() {
182         return maxLength;
183     }
184 
185 	/**
186      * <!-- begin-user-doc -->
187 	 * <!-- end-user-doc -->
188      * @generated
189      */
190 	public void setMaxLength(int newMaxLength) {
191         int oldMaxLength = maxLength;
192         maxLength = newMaxLength;
193         if (eNotificationRequired())
194             eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.STRING_PROPERTY__MAX_LENGTH, oldMaxLength, maxLength));
195     }
196 
197 	/**
198      * <!-- begin-user-doc -->
199 	 * <!-- end-user-doc -->
200      * @generated
201      */
202 	public String getDefaultValue() {
203         return defaultValue;
204     }
205 
206 	/**
207      * <!-- begin-user-doc -->
208 	 * <!-- end-user-doc -->
209      * @generated
210      */
211 	public void setDefaultValue(String newDefaultValue) {
212         String oldDefaultValue = defaultValue;
213         defaultValue = newDefaultValue;
214         if (eNotificationRequired())
215             eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.STRING_PROPERTY__DEFAULT_VALUE, oldDefaultValue, defaultValue));
216     }
217 
218 	/**
219      * <!-- begin-user-doc -->
220 	 * <!-- end-user-doc -->
221      * @generated
222      */
223 	@Override
224 	public Object eGet(int featureID, boolean resolve, boolean coreType) {
225         switch (featureID) {
226             case BusinessDomainDslPackage.STRING_PROPERTY__REGULAR_EXPRESSION:
227                 return getRegularExpression();
228             case BusinessDomainDslPackage.STRING_PROPERTY__MIN_LENGTH:
229                 return getMinLength();
230             case BusinessDomainDslPackage.STRING_PROPERTY__MAX_LENGTH:
231                 return getMaxLength();
232             case BusinessDomainDslPackage.STRING_PROPERTY__DEFAULT_VALUE:
233                 return getDefaultValue();
234         }
235         return super.eGet(featureID, resolve, coreType);
236     }
237 
238 	/**
239      * <!-- begin-user-doc -->
240 	 * <!-- end-user-doc -->
241      * @generated
242      */
243 	@Override
244 	public void eSet(int featureID, Object newValue) {
245         switch (featureID) {
246             case BusinessDomainDslPackage.STRING_PROPERTY__REGULAR_EXPRESSION:
247                 setRegularExpression((String)newValue);
248                 return;
249             case BusinessDomainDslPackage.STRING_PROPERTY__MIN_LENGTH:
250                 setMinLength((Integer)newValue);
251                 return;
252             case BusinessDomainDslPackage.STRING_PROPERTY__MAX_LENGTH:
253                 setMaxLength((Integer)newValue);
254                 return;
255             case BusinessDomainDslPackage.STRING_PROPERTY__DEFAULT_VALUE:
256                 setDefaultValue((String)newValue);
257                 return;
258         }
259         super.eSet(featureID, newValue);
260     }
261 
262 	/**
263      * <!-- begin-user-doc -->
264 	 * <!-- end-user-doc -->
265      * @generated
266      */
267 	@Override
268 	public void eUnset(int featureID) {
269         switch (featureID) {
270             case BusinessDomainDslPackage.STRING_PROPERTY__REGULAR_EXPRESSION:
271                 setRegularExpression(REGULAR_EXPRESSION_EDEFAULT);
272                 return;
273             case BusinessDomainDslPackage.STRING_PROPERTY__MIN_LENGTH:
274                 setMinLength(MIN_LENGTH_EDEFAULT);
275                 return;
276             case BusinessDomainDslPackage.STRING_PROPERTY__MAX_LENGTH:
277                 setMaxLength(MAX_LENGTH_EDEFAULT);
278                 return;
279             case BusinessDomainDslPackage.STRING_PROPERTY__DEFAULT_VALUE:
280                 setDefaultValue(DEFAULT_VALUE_EDEFAULT);
281                 return;
282         }
283         super.eUnset(featureID);
284     }
285 
286 	/**
287      * <!-- begin-user-doc -->
288 	 * <!-- end-user-doc -->
289      * @generated
290      */
291 	@Override
292 	public boolean eIsSet(int featureID) {
293         switch (featureID) {
294             case BusinessDomainDslPackage.STRING_PROPERTY__REGULAR_EXPRESSION:
295                 return REGULAR_EXPRESSION_EDEFAULT == null ? regularExpression != null : !REGULAR_EXPRESSION_EDEFAULT.equals(regularExpression);
296             case BusinessDomainDslPackage.STRING_PROPERTY__MIN_LENGTH:
297                 return minLength != MIN_LENGTH_EDEFAULT;
298             case BusinessDomainDslPackage.STRING_PROPERTY__MAX_LENGTH:
299                 return maxLength != MAX_LENGTH_EDEFAULT;
300             case BusinessDomainDslPackage.STRING_PROPERTY__DEFAULT_VALUE:
301                 return DEFAULT_VALUE_EDEFAULT == null ? defaultValue != null : !DEFAULT_VALUE_EDEFAULT.equals(defaultValue);
302         }
303         return super.eIsSet(featureID);
304     }
305 
306 	/**
307      * <!-- begin-user-doc -->
308 	 * <!-- end-user-doc -->
309      * @generated
310      */
311 	@Override
312 	public String toString() {
313         if (eIsProxy()) return super.toString();
314 
315         StringBuffer result = new StringBuffer(super.toString());
316         result.append(" (regularExpression: ");
317         result.append(regularExpression);
318         result.append(", minLength: ");
319         result.append(minLength);
320         result.append(", maxLength: ");
321         result.append(maxLength);
322         result.append(", defaultValue: ");
323         result.append(defaultValue);
324         result.append(')');
325         return result.toString();
326     }
327 
328 } //StringPropertyImpl