|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.fedmest.cw.keyboard.validators.ValueTypeValidator<java.lang.Boolean>
com.fedmest.cw.keyboard.validators.BooleanValidator
public final class BooleanValidator
This class is used internally by the KeyboardUtils.readBoolFromKeyboard() methods. It is used as a singleton via
getInstance(). There is really no need to use it other than through KeyboardUtils.
| Field Summary |
|---|
| Fields inherited from class com.fedmest.cw.keyboard.validators.ValueTypeValidator |
|---|
errorMessage |
| Method Summary | |
|---|---|
java.lang.Boolean |
cancelValue()
Allows you to specify the return value to offer when the user cancels input on a cancelable instance of KeyboardUtils
. |
java.lang.Boolean |
checkInput(java.lang.String txt)
Takes the input string, checks its validity and converts it to the data type specified by the type argument. |
static BooleanValidator |
getInstance()
Returns the only available instance of this class |
| Methods inherited from class com.fedmest.cw.keyboard.validators.ValueTypeValidator |
|---|
resetErrorMessage, setErrorMessage |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static BooleanValidator getInstance()
public java.lang.Boolean checkInput(java.lang.String txt)
throws KeyboardInputException
KeyboardInputValidatorKeyboardInputException is raised and the user will have to type their input again. If a null
reference is passed into the method, the method may throw a NullPointerException, so programmers do not need to worry
about checking for null pointers.
txt - the input text. If the string is null, NullPointerException will be thrown.
KeyboardInputException - if validation against the input string failedpublic java.lang.Boolean cancelValue()
KeyboardInputValidatorKeyboardUtils
. Though null should be returned in most cases, this method is useful when - for example - you want to return a
primitive type from your validator and can't use null as a return value without causing a bit of inconvenienve in
your application code (explicit unboxing and checks for null values).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||