java.lang.Cloneable, PromptBooleanPrompt, FixedSetPrompt, NumericPrompt, PlayerNamePrompt, RegexPromptpublic abstract class ValidatingPrompt extends java.lang.Object implements Prompt
END_OF_CONVERSATION| Constructor | Description |
|---|---|
ValidatingPrompt() |
| Modifier and Type | Method | Description |
|---|---|---|
Prompt |
acceptInput(ConversationContext context,
java.lang.String input) |
Accepts and processes input from the user and validates it.
|
protected abstract Prompt |
acceptValidatedInput(ConversationContext context,
java.lang.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 java.lang.String |
getFailedValidationText(ConversationContext context,
java.lang.String invalidInput) |
Optionally override this method to display an additional message if the
user enters an invalid input.
|
protected abstract boolean |
isInputValid(ConversationContext context,
java.lang.String input) |
Override this method to check the validity of the player's input.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPromptTextpublic Prompt acceptInput(ConversationContext context, java.lang.String input)
acceptInput in interface Promptcontext - Context information about the conversation.input - The input text from the user.public boolean blocksForInput(ConversationContext context)
blocksForInput in interface Promptcontext - Context information about the conversation.protected abstract boolean isInputValid(ConversationContext context, java.lang.String input)
context - Context information about the conversation.input - The player's raw console input.protected abstract Prompt acceptValidatedInput(ConversationContext context, java.lang.String input)
context - Context information about the conversation.input - The validated input text from the user.protected java.lang.String getFailedValidationText(ConversationContext context, java.lang.String invalidInput)
context - Context information about the conversation.invalidInput - The invalid input provided by the user.Copyright © 2018. All rights reserved.