dev.sixpack.client.InputBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdk Show documentation
Show all versions of sdk Show documentation
SDK to develop generators part of the Sixpack solution
The newest version!
package dev.sixpack.client;
import dev.sixpack.api.data.Configuration;
import dev.sixpack.api.data.Dataset;
public class InputBuilder {
private final Dataset dataset;
public InputBuilder(Dataset dataset) {
this.dataset = dataset;
}
/**
* Adds an input key/value pair to the dataset request.
*
* @param key The key of the input.
* @param value The value of the input. Except String, also Integer or Boolean are allowed as values. They need to match ethe expected structure of the dataset input.
* @return The same builder for chaining.
*/
@SuppressWarnings("UnusedReturnValue")
public InputBuilder withInput(String key, Object value) {
if (dataset.getInput() == null) {
dataset.setInput(new Configuration());
}
dataset.getInput().put(key, value);
return this;
}
/**
* Final method to close the builder chain and request the dataset. This method will effectively call Sixpack.
*
* @return The requested dataset returned by Sixpack.
*/
public Dataset request() {
return Sixpack.instance.requestDataset(dataset);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy