Skip to content

Commit c2db32c

Browse files
committed
refactor
1 parent 318115a commit c2db32c

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/main/java/de/rwth/idsg/steve/ocpp/converter/Server15to16Impl.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,11 @@ public DataTransferResponse convertResponse(ocpp.cs._2015._10.DataTransferRespon
229229
* but something else might make more sense at this place
230230
*/
231231
private static ChargePointStatus customMapStatus(ocpp.cs._2012._06.ChargePointStatus status) {
232-
if (status.equals(ocpp.cs._2012._06.ChargePointStatus.OCCUPIED)) {
233-
return ChargePointStatus.CHARGING;
234-
} else {
235-
return ChargePointStatus.fromValue(status.value());
232+
switch (status) {
233+
case OCCUPIED:
234+
return ChargePointStatus.CHARGING;
235+
default:
236+
return ChargePointStatus.fromValue(status.value());
236237
}
237238
}
238239

@@ -241,10 +242,11 @@ private static ChargePointStatus customMapStatus(ocpp.cs._2012._06.ChargePointSt
241242
* Update: According to the 1.6 specification, MODE_3_ERROR was simply renamed to EV_COMMUNICATION_ERROR
242243
*/
243244
private static ChargePointErrorCode customMapErrorCode(ocpp.cs._2012._06.ChargePointErrorCode errorCode15) {
244-
if (errorCode15.equals(ocpp.cs._2012._06.ChargePointErrorCode.MODE_3_ERROR)) {
245-
return ChargePointErrorCode.EV_COMMUNICATION_ERROR;
246-
} else {
247-
return ChargePointErrorCode.fromValue(errorCode15.value());
245+
switch (errorCode15) {
246+
case MODE_3_ERROR:
247+
return ChargePointErrorCode.EV_COMMUNICATION_ERROR;
248+
default:
249+
return ChargePointErrorCode.fromValue(errorCode15.value());
248250
}
249251
}
250252

0 commit comments

Comments
 (0)