import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import net.pterodactylus.fcp.ConfigData;
private final ListeningExecutorService threadPool;
private final ConnectionSupplier connectionSupplier;
+ private final AtomicBoolean withCurrent = new AtomicBoolean();
+ private final AtomicBoolean withDefaults = new AtomicBoolean();
public GetConfigCommandImpl(ExecutorService threadPool, ConnectionSupplier connectionSupplier) {
this.threadPool = MoreExecutors.listeningDecorator(threadPool);
}
@Override
+ public GetConfigCommand withCurrent() {
+ withCurrent.set(true);
+ return this;
+ }
+
+ @Override
+ public GetConfigCommand withDefaults() {
+ withDefaults.set(true);
+ return this;
+ }
+
+ @Override
public ListenableFuture<ConfigData> execute() {
return threadPool.submit(this::executeDialog);
}
private ConfigData executeDialog() throws IOException, ExecutionException, InterruptedException {
GetConfig getConfig = new GetConfig(new RandomIdentifierGenerator().generate());
+ getConfig.setWithCurrent(withCurrent.get());
+ getConfig.setWithDefaults(withDefaults.get());
try (GetConfigDialog getConfigDialog = new GetConfigDialog()) {
return getConfigDialog.send(getConfig).get();
}