public abstract class ConsoleUI extends Object
Constructor and Description |
---|
ConsoleUI() |
Modifier and Type | Method and Description |
---|---|
protected static Die |
abort()
Constructs an exception indicating the user aborted the operation.
|
void |
error(String format,
Object... args)
Display an error message on the system stderr.
|
static ConsoleUI |
getInstance()
Get a UI instance, assuming interactive mode.
|
static ConsoleUI |
getInstance(boolean batchMode)
Get a UI instance, possibly forcing batch mode.
|
abstract void |
header(String fmt,
Object... args)
Display a header message before a series of prompts.
|
abstract boolean |
isBatch() |
abstract void |
message(String fmt,
Object... args)
Display a message.
|
abstract String |
password(String fmt,
Object... args)
Prompt the user for a password, returning the string; null if blank.
|
abstract <T extends Enum<?>,A extends EnumSet<? extends T>> |
readEnum(T def,
A options,
String fmt,
Object... args)
Prompt the user to make a choice from an enumeration's values.
|
int |
readInt(int def,
String fmt,
Object... args)
Prompt the user for an integer value, suggesting a default.
|
abstract String |
readString(String def,
Set<String> allowedValues,
String fmt,
Object... args)
Prompt the user to make a choice from an allowed list of values.
|
abstract String |
readString(String def,
String fmt,
Object... args)
Prompt the user for a string, suggesting a default, and returning choice.
|
abstract void |
waitForUser()
Prints a message asking the user to let us know when its safe to continue.
|
abstract boolean |
yesno(Boolean def,
String fmt,
Object... args)
Request the user to answer a yes/no question.
|
public static ConsoleUI getInstance()
public static ConsoleUI getInstance(boolean batchMode)
protected static Die abort()
public abstract boolean isBatch()
public abstract void header(String fmt, Object... args)
public abstract boolean yesno(Boolean def, String fmt, Object... args)
public abstract void waitForUser()
public abstract String readString(String def, String fmt, Object... args)
public abstract String readString(String def, Set<String> allowedValues, String fmt, Object... args)
public int readInt(int def, String fmt, Object... args)
public abstract String password(String fmt, Object... args)
public void error(String format, Object... args)