io.bdeploy.common.cli.data.DataTableRowBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api Show documentation
Show all versions of api Show documentation
Public API including dependencies, ready to be used for integrations and plugins.
package io.bdeploy.common.cli.data;
import java.util.ArrayList;
import java.util.List;
/**
* Builds a table row cell by cell.
*/
public class DataTableRowBuilder {
private final DataTable target;
private final List cells = new ArrayList<>();
DataTableRowBuilder(DataTable target) {
this.target = target;
}
/**
* @param data a cell to add. If the cell is a {@link DataTableCell} it is applied as is, otherwise {@link #toString()} is
* called on the data.
*/
public DataTableRowBuilder cell(Object data) {
if (data instanceof DataTableCell) {
cells.add((DataTableCell) data);
} else {
cells.add(new DataTableCell(data));
}
return this;
}
public DataTable build() {
target.row(cells);
return target;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy