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

io.bdeploy.common.cli.data.DataFormat 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;

/**
 * The different DataTable formats.
 */
public enum DataFormat {

    TEXT,
    CSV,
    JSON;

    public DataTable createTable(PrintStream target) {
        switch (this) {
            case TEXT:
                return new DataTableText(target);
            case CSV:
                return new DataTableCsv(target);
            case JSON:
                return new DataTableJson(target);
        }
        throw new IllegalStateException("Unsupported DataFormat");
    }

    public DataResult createResult(PrintStream target) {
        switch (this) {
            case TEXT:
                return new DataResultText(target);
            case CSV:
                return new DataResultCsv(target);
            case JSON:
                return new DataResultJson(target);
        }
        throw new IllegalStateException("Unsupported DataFormat");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy