BooleanPrompt, FixedSetPrompt, NumericPrompt, PlayerNamePrompt, RegexPromptpublic abstract class ValidatingPrompt extends Object implements Prompt
END_OF_CONVERSATION| Constructor | Description |
|---|---|
ValidatingPrompt() |
| Modifier and Type | Method | Description |
|---|---|---|
Prompt |
acceptInput(ConversationContext context,
String input) |
Accepts and processes input from the user and validates it.
|
protected abstract Prompt |
acceptValidatedInput(ConversationContext context,
String input) |
Override this method to accept and processes the validated input from
the user.
|
boolean |
blocksForInput(ConversationContext context) |
Ensures that the prompt waits for the user to provide input.
|
protected String |
getFailedValidationText(ConversationContext context,
String invalidInput) |
Optionally override this method to display an additional message if the
user enters an invalid input.
|
protected abstract boolean |
isInputValid(ConversationContext context,
String input) |
Override this method to check the validity of the player's input.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPromptText@Nullable public Prompt acceptInput(@NotNull ConversationContext context, @Nullable String input)
acceptInput in interface Promptcontext - Context information about the conversation.input - The input text from the user.public boolean blocksForInput(@NotNull
ConversationContext context)
blocksForInput in interface Promptcontext - Context information about the conversation.protected abstract boolean isInputValid(@NotNull
ConversationContext context,
@NotNull
String input)
context - Context information about the conversation.input - The player's raw console input.@Nullable protected abstract Prompt acceptValidatedInput(@NotNull ConversationContext context, @NotNull String input)
context - Context information about the conversation.input - The validated input text from the user.@Nullable protected String getFailedValidationText(@NotNull ConversationContext context, @NotNull String invalidInput)
context - Context information about the conversation.invalidInput - The invalid input provided by the user.Copyright © 2020. All rights reserved.