mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-01 20:10: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
|
@ -42,11 +42,11 @@ public class UploadStickerPackCommand implements JsonRpcLocalCommand {
|
|||
|
||||
try {
|
||||
var url = m.uploadStickerPack(path);
|
||||
if (outputWriter instanceof PlainTextWriter writer) {
|
||||
writer.println("{}", url.getUrl());
|
||||
} else {
|
||||
final var writer = (JsonWriter) outputWriter;
|
||||
writer.write(Map.of("url", url.getUrl()));
|
||||
switch (outputWriter) {
|
||||
case PlainTextWriter writer -> writer.println("{}", url.getUrl());
|
||||
case JsonWriter writer -> {
|
||||
writer.write(Map.of("url", url.getUrl()));
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new IOErrorException("Upload error (maybe image size too large):" + e.getMessage(), e);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue