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

@ -10,14 +10,15 @@ import java.util.Map;
public class VersionCommand implements JsonRpcCommand<Void> {
private final OutputWriter outputWriter;
public VersionCommand(final OutputWriter outputWriter) {
this.outputWriter = outputWriter;
@Override
public String getName() {
return "version";
}
@Override
public void handleCommand(final Void request, final Manager m) throws CommandException {
public void handleCommand(
final Void request, final Manager m, final OutputWriter outputWriter
) throws CommandException {
final var jsonWriter = (JsonWriter) outputWriter;
jsonWriter.write(Map.of("version", BaseConfig.PROJECT_VERSION));
}