- Remove TaskOption and central logic for processing options. It is not flexible and clear enough without investing a lot of effort. Fix is easy - just pass the scanner and let the task do what it needs to do.
26 lines
521 B
Java
26 lines
521 B
Java
package utils;
|
|
|
|
import java.util.Scanner;
|
|
|
|
/**
|
|
* Common interface for tool tasks. Note that the implementing tasks are instantiated
|
|
* with the default constructor. It is required that it be public.
|
|
*/
|
|
public interface ToolTask {
|
|
|
|
/**
|
|
* Return the name of the task.
|
|
*
|
|
* @return Name of the task
|
|
*/
|
|
String getTaskName();
|
|
|
|
/**
|
|
* Execute the task.
|
|
*
|
|
* @param scanner Scanner to prompt the user with for options. Do not close it.
|
|
*/
|
|
void execute(Scanner scanner);
|
|
|
|
}
|