public class DefaultCommandContainer<T> extends Object implements CommandContainer<T>
Constructor and Description |
---|
DefaultCommandContainer() |
Modifier and Type | Method and Description |
---|---|
CommandContainer<T> |
addCommand(Command<T> command)
Adds a
Command to the list. |
CommandContainer<T> |
addCommand(int priority,
Command<T> command)
Adds a
Command to the list via priority. |
void |
execute(T parameterObject)
Executes the command.
|
boolean |
executeAsChain(T context)
Executes the commands as a chain.
|
String |
executeAsProcess(String startCommand,
T context)
Execute a command as a process.
|
String |
executeAsProcess(T context)
Execute a command as a process.
|
CommandTransitionEnum.CommandTransition |
executeCommand(T parameterObject)
Executes the command.
|
CommandTransitionEnum.CommandTransition |
executeCommandAsChain(T parameterObject) |
Command<T> |
getCommandByProcessID(String proceddID)
Gets the command with the certain processID.
|
String |
getProcessID()
Gets the process ID of the command.
|
void |
setProcessID(String processID)
Sets the process ID of the command
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addTransition, findNext, getTransitionList
public CommandContainer<T> addCommand(Command<T> command)
CommandContainer
Command
to the list. Because a
CommandContainer
is a Command
you can add
CommandContainer
objects as well.addCommand
in interface CommandContainer<T>
command
- The command to add.CommandContainer.addCommand(org.mwolff.command.Command)
public CommandContainer<T> addCommand(int priority, Command<T> command)
CommandContainer
Command
to the list via priority. Because a
CommandContainer
is a Command
you can add
CommandContainer
objects as well.addCommand
in interface CommandContainer<T>
priority
- A priority. If two commands has the same priority the first
wins.command
- The command to add.CommandContainer.addCommand(int,
org.mwolff.command.Command)
public boolean executeAsChain(T context)
executeAsChain
in interface ChainCommand<T>
context
- The parameter object to passpublic CommandTransitionEnum.CommandTransition executeCommandAsChain(T parameterObject)
executeCommandAsChain
in interface ChainCommand<T>
parameterObject
- The parameter object to pass.public String executeAsProcess(String startCommand, T context)
ProcessCommand
executeAsProcess
in interface ProcessCommand<T>
startCommand
- The command the process should start with.context
- The context to work with.ProcessCommand.executeAsProcess(java.lang.String,
java.lang.Object)
public Command<T> getCommandByProcessID(String proceddID)
CommandContainer
getCommandByProcessID
in interface CommandContainer<T>
proceddID
- The id to find the command.public String getProcessID()
ProcessCommand
getProcessID
in interface ProcessCommand<T>
public void setProcessID(String processID)
ProcessCommand
setProcessID
in interface ProcessCommand<T>
processID
- Sets the process id of this process command.public String executeAsProcess(T context)
ProcessCommand
executeAsProcess
in interface ProcessCommand<T>
context
- The context to work with.public CommandTransitionEnum.CommandTransition executeCommand(T parameterObject)
Command
executeCommand
in interface Command<T>
parameterObject
- The parameter object to pass.public void execute(T parameterObject) throws CommandException
Command
execute
in interface Command<T>
parameterObject
- The parameter object to pass.CommandException
- if something happens.Copyright © 2017 neusta software development GmbH. All rights reserved.