Class CommandService.Builder
- java.lang.Object
-
- com.microsoft.jenkins.azurecommons.command.CommandService.Builder
-
- Enclosing class:
- CommandService
public static final class CommandService.Builder extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CommandService
build()
CommandService.Builder
withCleanUpCommand(Class<? extends ICommand<? extends IBaseCommandData>> command)
Register an optional clean up command that will be executed when the all the normal commands finish execution, regardless of the termination state of the last command.CommandService.Builder
withSingleCommand(Class<? extends ICommand<? extends IBaseCommandData>> command)
Register a single command that may be used by other transitions.CommandService.Builder
withStartCommand(Class<? extends ICommand<? extends IBaseCommandData>> command)
Register the start command.CommandService.Builder
withTransition(Class<? extends ICommand<? extends IBaseCommandData>> current, Class<? extends ICommand<? extends IBaseCommandData>> next)
Register a transition from current command to the next command if current command is executed without error.
-
-
-
Method Detail
-
withTransition
public CommandService.Builder withTransition(Class<? extends ICommand<? extends IBaseCommandData>> current, Class<? extends ICommand<? extends IBaseCommandData>> next)
Register a transition from current command to the next command if current command is executed without error.- Parameters:
current
- the current commandnext
- the next command to be executed if current finishes successfully- Returns:
- the builder itself
-
withStartCommand
public CommandService.Builder withStartCommand(Class<? extends ICommand<? extends IBaseCommandData>> command)
Register the start command.- Parameters:
command
- the start command.- Returns:
- the builder itself
-
withCleanUpCommand
public CommandService.Builder withCleanUpCommand(Class<? extends ICommand<? extends IBaseCommandData>> command)
Register an optional clean up command that will be executed when the all the normal commands finish execution, regardless of the termination state of the last command.- Parameters:
command
- the clean up command- Returns:
- the builder itself.
-
withSingleCommand
public CommandService.Builder withSingleCommand(Class<? extends ICommand<? extends IBaseCommandData>> command)
Register a single command that may be used by other transitions.This ensures the command is instantiated early in the execution flow. It may be used for the followed commands of an
INextCommandAware
command, where the transition is defined by the command.- Parameters:
command
- the command to be registered.- Returns:
- the builder itself.
-
build
public CommandService build()
-
-