mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Use pattern matching switch cases
This commit is contained in:
parent
80c1a6d2af
commit
8d55dfb66b
27 changed files with 395 additions and 380 deletions
|
@ -223,13 +223,11 @@ public class SignalJsonRpcDispatcherHandler {
|
|||
}
|
||||
|
||||
private Integer getSubscriptionId(final JsonNode request) {
|
||||
if (request instanceof ArrayNode req) {
|
||||
return req.get(0).asInt();
|
||||
} else if (request instanceof ObjectNode req) {
|
||||
return req.get("subscription").asInt();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return switch (request) {
|
||||
case ArrayNode req -> req.get(0).asInt();
|
||||
case ObjectNode req -> req.get("subscription").asInt();
|
||||
case null, default -> null;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue