From 2005fd55347816cf4a86b66ae97bc245f53f0bcd Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 6 Jul 2024 19:47:06 -0700 Subject: Update switch statements --- .../traccar/protocol/EasyTrackProtocolEncoder.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/main/java/org/traccar/protocol/EasyTrackProtocolEncoder.java') diff --git a/src/main/java/org/traccar/protocol/EasyTrackProtocolEncoder.java b/src/main/java/org/traccar/protocol/EasyTrackProtocolEncoder.java index 3f2a142d6..124c3e0a3 100644 --- a/src/main/java/org/traccar/protocol/EasyTrackProtocolEncoder.java +++ b/src/main/java/org/traccar/protocol/EasyTrackProtocolEncoder.java @@ -28,18 +28,13 @@ public class EasyTrackProtocolEncoder extends StringProtocolEncoder { @Override protected Object encodeCommand(Command command) { - switch (command.getType()) { - case Command.TYPE_ENGINE_STOP: - return formatCommand(command, "*ET,%s,FD,Y1#", Command.KEY_UNIQUE_ID); - case Command.TYPE_ENGINE_RESUME: - return formatCommand(command, "*ET,%s,FD,Y2#", Command.KEY_UNIQUE_ID); - case Command.TYPE_ALARM_ARM: - return formatCommand(command, "*ET,%s,FD,F1#", Command.KEY_UNIQUE_ID); - case Command.TYPE_ALARM_DISARM: - return formatCommand(command, "*ET,%s,FD,F2#", Command.KEY_UNIQUE_ID); - default: - return null; - } + return switch (command.getType()) { + case Command.TYPE_ENGINE_STOP -> formatCommand(command, "*ET,%s,FD,Y1#", Command.KEY_UNIQUE_ID); + case Command.TYPE_ENGINE_RESUME -> formatCommand(command, "*ET,%s,FD,Y2#", Command.KEY_UNIQUE_ID); + case Command.TYPE_ALARM_ARM -> formatCommand(command, "*ET,%s,FD,F1#", Command.KEY_UNIQUE_ID); + case Command.TYPE_ALARM_DISARM -> formatCommand(command, "*ET,%s,FD,F2#", Command.KEY_UNIQUE_ID); + default -> null; + }; } } -- cgit v1.2.3