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