liquibase.command.CommandBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liquibase-core Show documentation
Show all versions of liquibase-core Show documentation
Liquibase is a tool for managing and executing database changes.
The 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));
}
}