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

dev.mccue.tools.javadoc.Javadoc Maven / Gradle / Ivy

There is a newer version: 2024.09.03
Show newest version
package dev.mccue.tools.javadoc;

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 Javadoc
        extends AbstractToolRunner {
    private Javadoc(Tool tool, JavadocArguments arguments) {
        super(tool, arguments);
    }

    private Javadoc() {
        super(
                Tool.ofToolProvider(ToolProvider.findFirst("javadoc").orElseThrow()),
                new JavadocArguments()
        );
    }

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

    public static Javadoc runner(Tool tool) {
        return new Javadoc(tool, new JavadocArguments());
    }

    public static Javadoc runner(Tool tool, JavadocArguments arguments) {
        return new Javadoc(tool, arguments);
    }

    public static Javadoc runner(JavadocArguments arguments) {
        return new Javadoc(
                Tool.ofToolProvider(ToolProvider.findFirst("javadoc").orElseThrow()),
                arguments
        );
    }

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

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

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

    public static void run(JavadocArguments 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