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

dev.mccue.tools.javap.Javap Maven / Gradle / Ivy

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

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

    private Javap() {
        super(
                Tool.ofToolProvider(ToolProvider.findFirst("javap").orElseThrow()),
                new JavapArguments()
        );
    }

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

    public static Javap runner(Tool tool) {
        return new Javap(tool, new JavapArguments());
    }

    public static Javap runner(Tool tool, JavapArguments arguments) {
        return new Javap(tool, arguments);
    }

    public static Javap runner(JavapArguments arguments) {
        return new Javap(
                Tool.ofToolProvider(ToolProvider.findFirst("javap").orElseThrow()),
                arguments
        );
    }

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

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

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

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