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