From d0536ccbc1b7234784c5e48288bbac00a60ef821 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 7 Jul 2024 07:33:16 -0700 Subject: Update switch statements --- .../org/traccar/protocol/PretraceProtocolEncoder.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/main/java/org/traccar/protocol/PretraceProtocolEncoder.java') diff --git a/src/main/java/org/traccar/protocol/PretraceProtocolEncoder.java b/src/main/java/org/traccar/protocol/PretraceProtocolEncoder.java index a109e7a07..354fc5992 100644 --- a/src/main/java/org/traccar/protocol/PretraceProtocolEncoder.java +++ b/src/main/java/org/traccar/protocol/PretraceProtocolEncoder.java @@ -36,15 +36,13 @@ public class PretraceProtocolEncoder extends BaseProtocolEncoder { String uniqueId = getUniqueId(command.getDeviceId()); - switch (command.getType()) { - case Command.TYPE_CUSTOM: - return formatCommand(uniqueId, command.getString(Command.KEY_DATA)); - case Command.TYPE_POSITION_PERIODIC: - return formatCommand( - uniqueId, String.format("D221%1$d,%1$d,,", command.getInteger(Command.KEY_FREQUENCY))); - default: - return null; - } + return switch (command.getType()) { + case Command.TYPE_CUSTOM -> formatCommand( + uniqueId, command.getString(Command.KEY_DATA)); + case Command.TYPE_POSITION_PERIODIC -> formatCommand( + uniqueId, String.format("D221%1$d,%1$d,,", command.getInteger(Command.KEY_FREQUENCY))); + default -> null; + }; } } -- cgit v1.2.3