|
Forge - Parent 1.0.7-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ShellPrompt
Method Summary | ||
---|---|---|
String |
prompt()
Prompt for user input, and return as a String. |
|
String |
prompt(String message)
Prompt for user input, first printing the given line, then return user input as a String. |
|
|
prompt(String message,
Class<T> clazz)
Prompt for user input, first printing the given message, then return user input cast to the type provided. |
|
|
prompt(String message,
Class<T> clazz,
T defaultIfEmpty)
Prompt for user input, first printing the given line, then returning user input as a converted value. |
|
String |
prompt(String message,
String defaultIfEmpty)
Prompt for user input, first printing the given line, then return user input as a String. |
|
String |
promptAndSwallowCR()
This works like prompt, however when a CR is received, the method returns the value, but does not produce a CR in the actual terminal buffer. |
|
boolean |
promptBoolean(String string)
Prompt for boolean user input (Y/n), first printing the given message, then returning user input as a boolean. |
|
boolean |
promptBoolean(String message,
boolean defaultIfEmpty)
Prompt for boolean user input (Y/n), first printing the given message, then returning user input as a boolean. |
|
int |
promptChoice(String message,
List<?> options)
Prompt for user input, first printing the given message, followed by an enumerated list of options (printing the String value of each item in the list.) Loop until the user enters a number corresponding to one of the options, then return the index of that option from the list. |
|
|
promptChoice(String message,
Map<String,T> options)
Prompt for user input, first printing the given message, followed by a keyed list of options. |
|
int |
promptChoice(String message,
Object... options)
Prompt for user input, first printing the given message, followed by an enumerated list of options (printing the String value of each item in the list.) Loop until the user enters a number corresponding to one of the options, then return the index of that option from the list. |
|
|
promptChoiceTyped(String message,
List<T> options)
Prompt for user input, first printing the given message, followed by an enumerated list of options (printing the String value of each item in the list.) Loop until the user enters a number corresponding to one of the options, then return that option from the list. |
|
|
promptChoiceTyped(String message,
List<T> options,
T defaultIfEmpty)
Prompt for user input, first printing the given message, followed by an enumerated list of options (printing the String value of each item in the list.) Loop until the user enters a number corresponding to one of the options, then return that option from the list. |
|
String |
promptCommon(String message,
PromptType type)
Prompt for user input, first printing the given message, then returning user input as a String. |
|
String |
promptCommon(String message,
PromptType type,
String defaultIfEmpty)
Same as promptCommon(String, PromptType) , but will default to a given value if user input is empty. |
|
String |
promptCompleter(String string,
Class<? extends CommandCompleter> type)
Prompt for user input, first printing the given line, then returning user input with help from the given completer type. |
|
|
promptEnum(String message,
Class<T> type)
Prompt for user input in the form of an Enum , first printing the given message, then returning user input
as a Enum . |
|
|
promptEnum(String message,
Class<T> type,
T defaultIfEmpty)
Prompt for user input in the form of an Enum , first printing the given message, then returning user input
as a Enum . |
|
FileResource<?> |
promptFile(String message)
Prompt for user input in the form of a file path, first printing the given message, then returning user input as a File. |
|
FileResource<?> |
promptFile(String message,
FileResource<?> defaultIfEmpty)
Prompt for user input in the form of a file path, first printing the given message, then returning user input as a File. |
|
String |
promptRegex(String message,
String regex)
Prompt for user input (Y/n), first printing the given message, then returning user input as a String. |
|
String |
promptRegex(String message,
String pattern,
String defaultIfEmpty)
Same as promptRegex(String, String) , but will default to a given value if user input is empty. |
|
String |
promptSecret(String message)
First print the given message, prompt the user for input (masking keystrokes for secrecy,) then return user input. |
|
String |
promptSecret(String string,
String defaultIfEmpty)
First print the given message, prompt the user for input (masking keystrokes for secrecy,) then return user input. |
Method Detail |
---|
String prompt()
String promptAndSwallowCR()
String prompt(String message)
String prompt(String message, String defaultIfEmpty)
defaultIfEmpty
- The value to be returned when an empty or whitespace-only user input is read.<T> T prompt(String message, Class<T> clazz)
boolean promptBoolean(String string)
true
if an empty or whitespace-only user input is read.
boolean promptBoolean(String message, boolean defaultIfEmpty)
defaultIfEmpty
- The value to be returned when an empty or whitespace-only user input is read.int promptChoice(String message, Object... options)
message
- The prompt message to display until valid input is enteredoptions
- The list of selection options
int promptChoice(String message, List<?> options)
message
- The prompt message to display until valid input is enteredoptions
- The list of selection options
<T> T promptChoiceTyped(String message, List<T> options)
T
- The type of the objects contained in the listmessage
- The prompt message to display until valid input is enteredoptions
- The list of selection options
<T> T promptChoiceTyped(String message, List<T> options, T defaultIfEmpty)
T
- The type of the objects contained in the listmessage
- The prompt message to display until valid input is enteredoptions
- The list of selection optionsdefaultIfEmpty
- The value to be returned when an empty or whitespace-only user input is read.
<T> T promptChoice(String message, Map<String,T> options)
T
- The type of the objects contained in the mapmessage
- The prompt message to display until valid input is enteredoptions
- The map of selection options
String promptCommon(String message, PromptType type)
message
- The prompt message to display until valid input is enteredtype
- The prompt type to which valid input must be matched<T extends Enum<T>> T promptEnum(String message, Class<T> type)
Enum
, first printing the given message, then returning user input
as a Enum
. The prompt will repeat until input matching the prompt type is entered.
message
- The prompt message to display until valid input is entered<T extends Enum<T>> T promptEnum(String message, Class<T> type, T defaultIfEmpty)
Enum
, first printing the given message, then returning user input
as a Enum
. The prompt will repeat until input matching the prompt type is entered.
message
- The prompt message to display until valid input is entereddefaultIfEmpty
- The value to be returned when an empty or whitespace-only user input is read.FileResource<?> promptFile(String message)
message
- The prompt message to display until valid input is enteredFileResource<?> promptFile(String message, FileResource<?> defaultIfEmpty)
message
- The prompt message to display until valid input is entereddefaultIfEmpty
- The value to be returned when an empty or whitespace-only user input is read.String promptCommon(String message, PromptType type, String defaultIfEmpty)
promptCommon(String, PromptType)
, but will default to a given value if user input is empty.
message
- The prompt message to display until valid input is enteredtype
- The prompt type to which valid input must be matcheddefaultIfEmpty
- The value to be returned when an empty or whitespace-only user input is read.String promptRegex(String message, String regex)
message
- The prompt message to display until valid input is enteredregex
- The regular expression to which valid input must be matchedString promptRegex(String message, String pattern, String defaultIfEmpty)
promptRegex(String, String)
, but will default to a given value if user input is empty.
message
- The prompt message to display until valid input is enteredpattern
- The regular expression to which valid input must be matcheddefaultIfEmpty
- The value to be returned when an empty or whitespace-only user input is read.<T> T prompt(String message, Class<T> clazz, T defaultIfEmpty)
clazz
- The type to which the value will be converted, if possible.defaultIfEmpty
- The value to be returned when an empty or whitespace-only user input is read.String promptCompleter(String string, Class<? extends CommandCompleter> type)
message
- The prompt message to display until valid input is enteredtype
- The command completer type to instantiate and use during completionString promptSecret(String message)
String promptSecret(String string, String defaultIfEmpty)
defaultIfEmpty
- The value to be returned when an empty or whitespace-only user input is read.
|
Forge - Parent 1.0.7-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |