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

dev.mccue.tools.jpackage.JPackage Maven / Gradle / Ivy

package dev.mccue.tools.jpackage;

import dev.mccue.tools.AbstractToolRunner;
import dev.mccue.tools.ExitStatusException;
import dev.mccue.tools.Tool;

import java.util.function.Consumer;
import java.util.spi.ToolProvider;

public final class JPackage
        extends AbstractToolRunner {
    private JPackage(Tool tool, JPackageArguments arguments) {
        super(tool, arguments);
    }

    private JPackage() {
        super(
                Tool.ofToolProvider(ToolProvider.findFirst("jpackage").orElseThrow()),
                new JPackageArguments()
        );
    }

    public static JPackage runner() {
        return new JPackage();
    }

    public static JPackage runner(Tool tool) {
        return new JPackage(tool, new JPackageArguments());
    }

    public static JPackage runner(Tool tool, JPackageArguments arguments) {
        return new JPackage(tool, arguments);
    }

    public static JPackage runner(JPackageArguments arguments) {
        return new JPackage(
                Tool.ofToolProvider(ToolProvider.findFirst("jpackage").orElseThrow()),
                arguments
        );
    }

    public static JPackage runner(Consumer consumer) {
        var jpackage = runner();
        consumer.accept(jpackage.arguments);
        return jpackage;
    }

    public static JPackage runner(Tool tool, Consumer consumer) {
        var jpackage = runner(tool);
        consumer.accept(jpackage.arguments);
        return jpackage;
    }

    public static void run(Tool tool, JPackageArguments arguments) throws ExitStatusException {
        new JPackage(tool, arguments).run();
    }

    public static void run(JPackageArguments arguments) throws ExitStatusException {
        runner(arguments).run();
    }

    public static void run(Tool tool, Consumer consumer) throws ExitStatusException {
        runner(tool, consumer).run();
    }

    public static void run(Consumer consumer) throws ExitStatusException {
        runner(consumer).run();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy