@@ -130,71 +130,47 @@ public String getStringBody() {
130
130
}
131
131
132
132
public String getStringBody (String def ) {
133
- if (body == null ) {
134
- return def ;
135
- } else {
136
- return body ;
137
- }
133
+ return body == null ? def : body ;
138
134
}
139
135
140
136
public Boolean getBooleanBody () {
141
137
return getBooleanBody (null );
142
138
}
143
139
144
140
public Boolean getBooleanBody (Boolean def ) {
145
- if (body == null ) {
146
- return def ;
147
- } else {
148
- return Boolean .valueOf (body );
149
- }
141
+ return body == null ? def : Boolean .valueOf (body );
150
142
}
151
143
152
144
public Integer getIntBody () {
153
145
return getIntBody (null );
154
146
}
155
147
156
148
public Integer getIntBody (Integer def ) {
157
- if (body == null ) {
158
- return def ;
159
- } else {
160
- return Integer .parseInt (body );
161
- }
149
+ return body == null ? def : Integer .valueOf (body );
162
150
}
163
151
164
152
public Long getLongBody () {
165
153
return getLongBody (null );
166
154
}
167
155
168
156
public Long getLongBody (Long def ) {
169
- if (body == null ) {
170
- return def ;
171
- } else {
172
- return Long .parseLong (body );
173
- }
157
+ return body == null ? def : Long .valueOf (body );
174
158
}
175
159
176
160
public Double getDoubleBody () {
177
161
return getDoubleBody (null );
178
162
}
179
163
180
164
public Double getDoubleBody (Double def ) {
181
- if (body == null ) {
182
- return def ;
183
- } else {
184
- return Double .parseDouble (body );
185
- }
165
+ return body == null ? def : Double .valueOf (body );
186
166
}
187
167
188
168
public Float getFloatBody () {
189
169
return getFloatBody (null );
190
170
}
191
171
192
172
public Float getFloatBody (Float def ) {
193
- if (body == null ) {
194
- return def ;
195
- } else {
196
- return Float .parseFloat (body );
197
- }
173
+ return body == null ? def : Float .valueOf (body );
198
174
}
199
175
200
176
public <T extends Enum <T >> T getEnumAttribute (Class <T > enumType , String name ) {
@@ -203,11 +179,7 @@ public <T extends Enum<T>> T getEnumAttribute(Class<T> enumType, String name) {
203
179
204
180
public <T extends Enum <T >> T getEnumAttribute (Class <T > enumType , String name , T def ) {
205
181
String value = getStringAttribute (name );
206
- if (value == null ) {
207
- return def ;
208
- } else {
209
- return Enum .valueOf (enumType , value );
210
- }
182
+ return value == null ? def : Enum .valueOf (enumType ,value );
211
183
}
212
184
213
185
/**
@@ -234,11 +206,7 @@ public String getStringAttribute(String name) {
234
206
235
207
public String getStringAttribute (String name , String def ) {
236
208
String value = attributes .getProperty (name );
237
- if (value == null ) {
238
- return def ;
239
- } else {
240
- return value ;
241
- }
209
+ return value == null ? def : value ;
242
210
}
243
211
244
212
public Boolean getBooleanAttribute (String name ) {
@@ -247,11 +215,7 @@ public Boolean getBooleanAttribute(String name) {
247
215
248
216
public Boolean getBooleanAttribute (String name , Boolean def ) {
249
217
String value = attributes .getProperty (name );
250
- if (value == null ) {
251
- return def ;
252
- } else {
253
- return Boolean .valueOf (value );
254
- }
218
+ return value == null ? def : Boolean .valueOf (value );
255
219
}
256
220
257
221
public Integer getIntAttribute (String name ) {
@@ -260,11 +224,7 @@ public Integer getIntAttribute(String name) {
260
224
261
225
public Integer getIntAttribute (String name , Integer def ) {
262
226
String value = attributes .getProperty (name );
263
- if (value == null ) {
264
- return def ;
265
- } else {
266
- return Integer .parseInt (value );
267
- }
227
+ return value == null ? def : Integer .valueOf (value );
268
228
}
269
229
270
230
public Long getLongAttribute (String name ) {
@@ -273,11 +233,7 @@ public Long getLongAttribute(String name) {
273
233
274
234
public Long getLongAttribute (String name , Long def ) {
275
235
String value = attributes .getProperty (name );
276
- if (value == null ) {
277
- return def ;
278
- } else {
279
- return Long .parseLong (value );
280
- }
236
+ return value == null ? def : Long .valueOf (value );
281
237
}
282
238
283
239
public Double getDoubleAttribute (String name ) {
@@ -286,11 +242,7 @@ public Double getDoubleAttribute(String name) {
286
242
287
243
public Double getDoubleAttribute (String name , Double def ) {
288
244
String value = attributes .getProperty (name );
289
- if (value == null ) {
290
- return def ;
291
- } else {
292
- return Double .parseDouble (value );
293
- }
245
+ return value == null ? def : Double .valueOf (value );
294
246
}
295
247
296
248
public Float getFloatAttribute (String name ) {
@@ -299,11 +251,7 @@ public Float getFloatAttribute(String name) {
299
251
300
252
public Float getFloatAttribute (String name , Float def ) {
301
253
String value = attributes .getProperty (name );
302
- if (value == null ) {
303
- return def ;
304
- } else {
305
- return Float .parseFloat (value );
306
- }
254
+ return value == null ? def : Float .valueOf (value );
307
255
}
308
256
309
257
public List <XNode > getChildren () {
0 commit comments