1
2
3
4
5
6
7 package org.mod4j.dsl.datacontract.mm.DataContractDsl.impl;
8
9 import java.math.BigDecimal;
10 import org.eclipse.emf.common.notify.Notification;
11 import org.eclipse.emf.ecore.EClass;
12
13 import org.eclipse.emf.ecore.impl.ENotificationImpl;
14 import org.mod4j.dsl.datacontract.mm.DataContractDsl.DataContractDslPackage;
15 import org.mod4j.dsl.datacontract.mm.DataContractDsl.DtoDecimalProperty;
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 public class DtoDecimalPropertyImpl extends DtoDataPropertyImpl implements DtoDecimalProperty {
31
32
33
34
35
36
37
38
39 protected static final BigDecimal DEFAULT_VALUE_EDEFAULT = null;
40
41
42
43
44
45
46
47
48 protected BigDecimal defaultValue = DEFAULT_VALUE_EDEFAULT;
49
50
51
52
53
54
55 protected DtoDecimalPropertyImpl() {
56 super();
57 }
58
59
60
61
62
63
64 @Override
65 protected EClass eStaticClass() {
66 return DataContractDslPackage.Literals.DTO_DECIMAL_PROPERTY;
67 }
68
69
70
71
72
73
74 public BigDecimal getDefaultValue() {
75 return defaultValue;
76 }
77
78
79
80
81
82
83 public void setDefaultValue(BigDecimal newDefaultValue) {
84 BigDecimal oldDefaultValue = defaultValue;
85 defaultValue = newDefaultValue;
86 if (eNotificationRequired())
87 eNotify(new ENotificationImpl(this, Notification.SET, DataContractDslPackage.DTO_DECIMAL_PROPERTY__DEFAULT_VALUE, oldDefaultValue, defaultValue));
88 }
89
90
91
92
93
94
95 @Override
96 public Object eGet(int featureID, boolean resolve, boolean coreType) {
97 switch (featureID) {
98 case DataContractDslPackage.DTO_DECIMAL_PROPERTY__DEFAULT_VALUE:
99 return getDefaultValue();
100 }
101 return super.eGet(featureID, resolve, coreType);
102 }
103
104
105
106
107
108
109 @Override
110 public void eSet(int featureID, Object newValue) {
111 switch (featureID) {
112 case DataContractDslPackage.DTO_DECIMAL_PROPERTY__DEFAULT_VALUE:
113 setDefaultValue((BigDecimal)newValue);
114 return;
115 }
116 super.eSet(featureID, newValue);
117 }
118
119
120
121
122
123
124 @Override
125 public void eUnset(int featureID) {
126 switch (featureID) {
127 case DataContractDslPackage.DTO_DECIMAL_PROPERTY__DEFAULT_VALUE:
128 setDefaultValue(DEFAULT_VALUE_EDEFAULT);
129 return;
130 }
131 super.eUnset(featureID);
132 }
133
134
135
136
137
138
139 @Override
140 public boolean eIsSet(int featureID) {
141 switch (featureID) {
142 case DataContractDslPackage.DTO_DECIMAL_PROPERTY__DEFAULT_VALUE:
143 return DEFAULT_VALUE_EDEFAULT == null ? defaultValue != null : !DEFAULT_VALUE_EDEFAULT.equals(defaultValue);
144 }
145 return super.eIsSet(featureID);
146 }
147
148
149
150
151
152
153 @Override
154 public String toString() {
155 if (eIsProxy()) return super.toString();
156
157 StringBuffer result = new StringBuffer(super.toString());
158 result.append(" (defaultValue: ");
159 result.append(defaultValue);
160 result.append(')');
161 return result.toString();
162 }
163
164 }