1
2
3
4
5
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
22
23
24
25
26
27
28
29
30
31
32
33
34 public class EnumerationPropertyImpl extends PropertyImpl implements EnumerationProperty {
35
36
37
38
39
40
41
42
43 protected Enumeration type;
44
45
46
47
48
49
50
51
52
53 protected static final String DEFAULT_VALUE_AS_STRING_EDEFAULT = null;
54
55
56
57
58
59
60
61
62
63 protected String defaultValueAsString = DEFAULT_VALUE_AS_STRING_EDEFAULT;
64
65
66
67
68
69
70 protected EnumerationPropertyImpl() {
71 super();
72 }
73
74
75
76
77
78
79 @Override
80 protected EClass eStaticClass() {
81 return BusinessDomainDslPackage.Literals.ENUMERATION_PROPERTY;
82 }
83
84
85
86
87
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
103
104
105
106 public Enumeration basicGetType() {
107 return type;
108 }
109
110
111
112
113
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
124
125
126
127 public String getDefaultValueAsString() {
128 return defaultValueAsString;
129 }
130
131
132
133
134
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
145
146
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
162
163
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
180
181
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
198
199
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
214
215
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 }