![JAR search and dependency download from the Maven repository](/logo.png)
nyla.solutions.global.patterns.command.CommandThread Maven / Gradle / Ivy
/**
*
*/
package nyla.solutions.global.patterns.command;
import nyla.solutions.global.exception.RequiredException;
/**
* @author Gregory Green
*
*/
public class CommandThread extends Thread implements Runnable, Command
{
public CommandThread()
{
}// ------------------------------------------------
public CommandThread(Command cmd, InputType argument)
{
this.command = cmd;
this.argument = argument;
}// ------------------------------------------------
/* (non-Javadoc)
* @see solutions.global.patterns.command.Command#execute(java.lang.Object)
*/
public ReturnType execute(InputType source)
{
if (this.command == null)
throw new RequiredException("this.command");
return this.command.execute(this.argument);
}// ------------------------------------------------
/* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
public void run()
{
if(this.command == null)
throw new RequiredException("this.command");
results = this.command.execute(argument);
}// ------------------------------------------------
/**
* @return the results
*/
public Object getResults()
{
return results;
}
/**
* @param results the results to set
*/
public void setResults(ReturnType results)
{
this.results = results;
}
/**
* @return the argument
*/
public Object getArgument()
{
return argument;
}
/**
* @param argument the argument to set
*/
public void setArgument(InputType argument)
{
this.argument = argument;
}
/**
* @return the command
*/
public Command getCommand()
{
return command;
}
/**
* @param command the command to set
*/
public void setCommand(Command command)
{
this.command = command;
}
private ReturnType results = null;
private InputType argument = null;
private Command command = null;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy