Refactor command creation

This commit is contained in:
AsamK 2021-08-20 18:42:38 +02:00
parent 47143a90e1
commit af292d8f0e
45 changed files with 436 additions and 282 deletions

View file

@ -3,10 +3,11 @@ package org.asamk.signal.commands;
import com.fasterxml.jackson.core.type.TypeReference;
import org.asamk.signal.OutputType;
import org.asamk.signal.OutputWriter;
import org.asamk.signal.commands.exceptions.CommandException;
import org.asamk.signal.manager.Manager;
import java.util.Set;
import java.util.List;
public interface JsonRpcCommand<T> extends Command {
@ -14,9 +15,9 @@ public interface JsonRpcCommand<T> extends Command {
return null;
}
void handleCommand(T request, Manager m) throws CommandException;
void handleCommand(T request, Manager m, OutputWriter outputWriter) throws CommandException;
default Set<OutputType> getSupportedOutputTypes() {
return Set.of(OutputType.JSON);
default List<OutputType> getSupportedOutputTypes() {
return List.of(OutputType.JSON);
}
}