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

liquibase.command.CommandBuilder Maven / Gradle / Ivy

There is a newer version: 4.30.0
Show newest version
package liquibase.command;

/**
 * Builder for configuring {@link CommandStep} settings, such as {@link CommandArgumentDefinition}s and {@link CommandResultDefinition}s
 */
public class CommandBuilder {

    private final String[][] commandNames;

    /**
     * Creates a builder for the given command name
     */
    public CommandBuilder(String[]... commandNames) {
        this.commandNames = commandNames;
    }

    /**
     * Starts the building of a new {@link CommandArgumentDefinition}.
     */
    public  CommandArgumentDefinition.Building argument(String name, Class type) {
        return new CommandArgumentDefinition.Building<>(commandNames, new CommandArgumentDefinition<>(name, type));
    }

    /**
     * Starts the building of a new {@link CommandArgumentDefinition}.
     */
    public  CommandArgumentDefinition.Building argument(CommonArgumentNames argument, Class type) {
        return new CommandArgumentDefinition.Building<>(commandNames, new CommandArgumentDefinition<>(argument.getArgumentName(), type));
    }

    /**
     * Uses an existing {@link CommandArgumentDefinition} as template
     */
    public  CommandArgumentDefinition.Building addArgument(CommandArgumentDefinition example) {
        return new CommandArgumentDefinition.Building<>(commandNames, example);
    }

    /**
     * Starts the building of a new {@link CommandResultDefinition}.
     */
    public  CommandResultDefinition.Building result(String name, Class type) {
        return new CommandResultDefinition.Building<>(new CommandResultDefinition<>(name, type));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy