mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-01-26 18:53:34 +00:00
Use SequencedCollection instead of List
This commit is contained in:
parent
0bd4d554d8
commit
14297986f2
@ -3,12 +3,13 @@ package org.asamk.signal.commands;
|
||||
import org.asamk.signal.OutputType;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.SequencedCollection;
|
||||
|
||||
public interface Command {
|
||||
|
||||
String getName();
|
||||
|
||||
default List<OutputType> getSupportedOutputTypes() {
|
||||
default SequencedCollection<OutputType> getSupportedOutputTypes() {
|
||||
return List.of(OutputType.PLAIN_TEXT);
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@ import java.nio.channels.Channel;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.SequencedCollection;
|
||||
|
||||
import static org.asamk.signal.util.CommandUtil.getReceiveConfig;
|
||||
|
||||
@ -87,7 +88,7 @@ public class DaemonCommand implements MultiLocalCommand, LocalCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OutputType> getSupportedOutputTypes() {
|
||||
public SequencedCollection<OutputType> getSupportedOutputTypes() {
|
||||
return List.of(OutputType.PLAIN_TEXT, OutputType.JSON);
|
||||
}
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@ import org.asamk.signal.output.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.SequencedCollection;
|
||||
|
||||
public class DeleteLocalAccountDataCommand implements RegistrationCommand, JsonRpcRegistrationCommand<Map<String, Object>> {
|
||||
|
||||
@ -54,7 +55,7 @@ public class DeleteLocalAccountDataCommand implements RegistrationCommand, JsonR
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OutputType> getSupportedOutputTypes() {
|
||||
public SequencedCollection<OutputType> getSupportedOutputTypes() {
|
||||
return List.of(OutputType.PLAIN_TEXT, OutputType.JSON);
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import org.asamk.signal.OutputType;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.SequencedCollection;
|
||||
|
||||
public interface JsonRpcCommand<T> extends Command {
|
||||
|
||||
@ -12,7 +13,7 @@ public interface JsonRpcCommand<T> extends Command {
|
||||
return null;
|
||||
}
|
||||
|
||||
default List<OutputType> getSupportedOutputTypes() {
|
||||
default SequencedCollection<OutputType> getSupportedOutputTypes() {
|
||||
return List.of(OutputType.JSON);
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.channels.Channels;
|
||||
import java.util.List;
|
||||
import java.util.SequencedCollection;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.asamk.signal.util.CommandUtil.getReceiveConfig;
|
||||
@ -53,7 +54,7 @@ public class JsonRpcDispatcherCommand implements LocalCommand, MultiLocalCommand
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OutputType> getSupportedOutputTypes() {
|
||||
public SequencedCollection<OutputType> getSupportedOutputTypes() {
|
||||
return List.of(OutputType.JSON);
|
||||
}
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ import org.asamk.signal.output.JsonWriter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.SequencedCollection;
|
||||
|
||||
public interface JsonRpcLocalCommand extends JsonRpcSingleCommand<Map<String, Object>>, LocalCommand {
|
||||
|
||||
@ -23,7 +24,7 @@ public interface JsonRpcLocalCommand extends JsonRpcSingleCommand<Map<String, Ob
|
||||
handleCommand(commandNamespace, m, jsonWriter);
|
||||
}
|
||||
|
||||
default List<OutputType> getSupportedOutputTypes() {
|
||||
default SequencedCollection<OutputType> getSupportedOutputTypes() {
|
||||
return List.of(OutputType.PLAIN_TEXT, OutputType.JSON);
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ import org.asamk.signal.output.JsonWriter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.SequencedCollection;
|
||||
|
||||
public interface JsonRpcMultiLocalCommand extends JsonRpcMultiCommand<Map<String, Object>>, MultiLocalCommand {
|
||||
|
||||
@ -27,7 +28,7 @@ public interface JsonRpcMultiLocalCommand extends JsonRpcMultiCommand<Map<String
|
||||
handleCommand(commandNamespace, c, jsonWriter);
|
||||
}
|
||||
|
||||
default List<OutputType> getSupportedOutputTypes() {
|
||||
default SequencedCollection<OutputType> getSupportedOutputTypes() {
|
||||
return List.of(OutputType.PLAIN_TEXT, OutputType.JSON);
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.SequencedCollection;
|
||||
|
||||
public class ReceiveCommand implements LocalCommand, JsonRpcSingleCommand<ReceiveCommand.ReceiveParams> {
|
||||
|
||||
@ -60,7 +61,7 @@ public class ReceiveCommand implements LocalCommand, JsonRpcSingleCommand<Receiv
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OutputType> getSupportedOutputTypes() {
|
||||
public SequencedCollection<OutputType> getSupportedOutputTypes() {
|
||||
return List.of(OutputType.PLAIN_TEXT, OutputType.JSON);
|
||||
}
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ import org.asamk.signal.util.CommandUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.SequencedCollection;
|
||||
|
||||
public class RegisterCommand implements RegistrationCommand, JsonRpcRegistrationCommand<RegisterCommand.RegistrationParams> {
|
||||
|
||||
@ -57,7 +58,7 @@ public class RegisterCommand implements RegistrationCommand, JsonRpcRegistration
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OutputType> getSupportedOutputTypes() {
|
||||
public SequencedCollection<OutputType> getSupportedOutputTypes() {
|
||||
return List.of(OutputType.PLAIN_TEXT, OutputType.JSON);
|
||||
}
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.SequencedCollection;
|
||||
|
||||
public class VerifyCommand implements RegistrationCommand, JsonRpcRegistrationCommand<VerifyCommand.VerifyParams> {
|
||||
|
||||
@ -50,7 +51,7 @@ public class VerifyCommand implements RegistrationCommand, JsonRpcRegistrationCo
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OutputType> getSupportedOutputTypes() {
|
||||
public SequencedCollection<OutputType> getSupportedOutputTypes() {
|
||||
return List.of(OutputType.PLAIN_TEXT, OutputType.JSON);
|
||||
}
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@ import org.asamk.signal.output.PlainTextWriter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.SequencedCollection;
|
||||
|
||||
public class VersionCommand implements JsonRpcLocalCommand, JsonRpcMultiLocalCommand {
|
||||
|
||||
@ -25,7 +26,7 @@ public class VersionCommand implements JsonRpcLocalCommand, JsonRpcMultiLocalCom
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OutputType> getSupportedOutputTypes() {
|
||||
public SequencedCollection<OutputType> getSupportedOutputTypes() {
|
||||
return List.of(OutputType.PLAIN_TEXT, OutputType.JSON);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user