Skip to content

Commit 5f60706

Browse files
committed
nits
1 parent 63e1fb3 commit 5f60706

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

src/main/java/de/rwth/idsg/steve/ocpp/ChargePointServiceInvoker.java

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
import de.rwth.idsg.steve.ocpp.task.UpdateFirmwareTask;
4040
import de.rwth.idsg.steve.repository.dto.ChargePointSelect;
4141

42+
/**
43+
* @author Sevket Goekay <[email protected]>
44+
* @since 05.01.2025
45+
*/
4246
public interface ChargePointServiceInvoker {
4347

4448
// -------------------------------------------------------------------------

src/main/java/de/rwth/idsg/steve/ocpp/CommunicationTask.java

+10-12
Original file line numberDiff line numberDiff line change
@@ -145,21 +145,19 @@ protected void failed(String chargeBoxId, Exception exception) {
145145
}
146146

147147
public RequestType getRequest() {
148-
switch (ocppVersion) {
149-
case V_12: return getOcpp12Request();
150-
case V_15: return getOcpp15Request();
151-
case V_16: return getOcpp16Request();
152-
default: throw new RuntimeException("Request type not found");
153-
}
148+
return switch (ocppVersion) {
149+
case V_12 -> getOcpp12Request();
150+
case V_15 -> getOcpp15Request();
151+
case V_16 -> getOcpp16Request();
152+
};
154153
}
155154

156155
public <T extends ResponseType> AsyncHandler<T> getHandler(String chargeBoxId) {
157-
switch (ocppVersion) {
158-
case V_12: return getOcpp12Handler(chargeBoxId);
159-
case V_15: return getOcpp15Handler(chargeBoxId);
160-
case V_16: return getOcpp16Handler(chargeBoxId);
161-
default: throw new RuntimeException("ResponseType handler not found");
162-
}
156+
return switch (ocppVersion) {
157+
case V_12 -> getOcpp12Handler(chargeBoxId);
158+
case V_15 -> getOcpp15Handler(chargeBoxId);
159+
case V_16 -> getOcpp16Handler(chargeBoxId);
160+
};
163161
}
164162

165163
public abstract OcppCallback<RESPONSE> defaultCallback();

0 commit comments

Comments
 (0)