All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.bdeploy.common.cli.data.DataResultCsv Maven / Gradle / Ivy

Go to download

Public API including dependencies, ready to be used for integrations and plugins.

There is a newer version: 7.3.6
Show newest version
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