io.bdeploy.common.cli.data.DataResultCsv 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.io.PrintStream;
import java.util.Map;
import io.bdeploy.common.util.ExceptionHelper;
public class DataResultCsv extends DataResultBase {
public DataResultCsv(PrintStream output) {
super(output);
}
@Override
public void render() {
out().println("\"Result Field\",\"Result Value\"");
if (getMessage() != null) {
out().println("\"Message\"," + DataTableCsv.quote(getMessage()));
}
if (getThrowable() != null) {
out().println("\"Error\"," + DataTableCsv.quote(ExceptionHelper.mapExceptionCausesToReason(getThrowable())));
} else {
for (Map.Entry entry : getFields().entrySet()) {
out().println(DataTableCsv.quote(entry.getKey()) + "," + DataTableCsv.quote(entry.getValue()));
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy