Package org.mwolff.command.builder
Class InjectionChainBuilder<T>
- java.lang.Object
-
- org.mwolff.command.builder.InjectionChainBuilder<T>
-
- All Implemented Interfaces:
ChainCommand<T>
,Command<T>
,ProcessCommand<T>
public class InjectionChainBuilder<T> extends Object implements Command<T>, ProcessCommand<T>, ChainCommand<T>
-
-
Field Summary
-
Fields inherited from interface org.mwolff.command.process.ProcessCommand
END
-
-
Constructor Summary
Constructors Constructor Description InjectionChainBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CommandContainer<T>
buildChain()
Builds the chain for this builder.Optional<String>
executeAsProcess(String startCommand, T context)
Execute a command as a process.Optional<String>
executeAsProcess(T context)
Execute a command as a process.CommandTransition
executeCommand(T parameterObject)
Executes the command.CommandTransition
executeCommandAsChain(T parameterObject)
String
getProcessID()
Gets the process ID of the command.void
setCommands(List<Command<T>> commands)
Sets the list of commands.void
setProcessID(String processID)
Sets the process ID of the command-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.mwolff.command.process.ProcessCommand
addTransition, findNext, getTransitionList
-
-
-
-
Method Detail
-
executeCommand
public CommandTransition executeCommand(T parameterObject)
Description copied from interface:Command
Executes the command. The command can have the result SUCCESS if everything is fine or FAILURE if an error occurred.- Specified by:
executeCommand
in interfaceCommand<T>
- Parameters:
parameterObject
- The parameter object to pass.- Returns:
- FAILURE if something went wrong, SUCCESS otherwise.
-
executeCommandAsChain
public CommandTransition executeCommandAsChain(T parameterObject)
- Specified by:
executeCommandAsChain
in interfaceChainCommand<T>
- Parameters:
parameterObject
- The parameter object to pass.- Returns:
- SUCCESS is the next chain should overtake, ABORT otherwise.
- See Also:
ChainCommand.executeCommandAsChain(java.lang.Object)
-
executeAsProcess
public Optional<String> executeAsProcess(String startCommand, T context)
Description copied from interface:ProcessCommand
Execute a command as a process. The result is the decision which process step should be executed next.- Specified by:
executeAsProcess
in interfaceProcessCommand<T>
- Parameters:
startCommand
- The command the process should start with.context
- The context to work with.- Returns:
- The next process step to execute. Null stops the process.
- See Also:
ProcessCommand.executeAsProcess(java.lang.String, java.lang.Object)
-
buildChain
protected CommandContainer<T> buildChain()
Builds the chain for this builder.- Returns:
- Returns the command container build.
-
getProcessID
public String getProcessID()
Description copied from interface:ProcessCommand
Gets the process ID of the command.- Specified by:
getProcessID
in interfaceProcessCommand<T>
- Returns:
- The process ID
- See Also:
ProcessCommand.getProcessID()
-
setCommands
public void setCommands(List<Command<T>> commands)
Sets the list of commands.- Parameters:
commands
- Command to set from the injection framework.
-
setProcessID
public void setProcessID(String processID)
Description copied from interface:ProcessCommand
Sets the process ID of the command- Specified by:
setProcessID
in interfaceProcessCommand<T>
- Parameters:
processID
- Sets the process id of this process command.- See Also:
ProcessCommand.setProcessID(java.lang.String)
-
executeAsProcess
public Optional<String> executeAsProcess(T context)
Description copied from interface:ProcessCommand
Execute a command as a process. The result is the decision which process step should be executed next.- Specified by:
executeAsProcess
in interfaceProcessCommand<T>
- Parameters:
context
- The context to work with.- Returns:
- The next process step to execute. Null stops the process.
- See Also:
ProcessCommand.executeAsProcess(java.lang.Object)
-
-