Class TextValidationRules
java.lang.Object
org.strassburger.tui4j.input.validationrules.TextValidationRules
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ValidationRule<String>Returns a validation rule that checks if the input is alphanumeric.static ValidationRule<String>alphanumeric(String errorMessage) Returns a validation rule that checks if the input is alphanumeric with a custom string error message.static ValidationRule<String>alphanumeric(StyledText errorMessage) Returns a validation rule that checks if the input is alphanumeric with a custom error message.static ValidationRule<String>Returns a validation rule that checks if the input is not empty.static ValidationRule<String>disallowEmpty(String errorMessage) Returns a validation rule that checks if the input is not empty with a custom string error message.static ValidationRule<String>disallowEmpty(StyledText errorMessage) Returns a validation rule that checks if the input is not empty with a custom error message.static ValidationRule<String>maxLength(int length) Returns a validation rule that checks if the input is at most a certain length.static ValidationRule<String>Returns a validation rule that checks if the input is at most a certain length with a custom string error message.static ValidationRule<String>maxLength(int length, StyledText errorMessage) Returns a validation rule that checks if the input is at most a certain length with a custom error message.static ValidationRule<String>minLength(int length) Returns a validation rule that checks if the input is at least a certain length.static ValidationRule<String>Returns a validation rule that checks if the input is at least a certain length with a custom string error message.static ValidationRule<String>minLength(int length, StyledText errorMessage) Returns a validation rule that checks if the input is at least a certain length with a custom error message.static ValidationRule<String>Returns a validation rule that checks if the input does not contain numbers.static ValidationRule<String>Returns a validation rule that checks if the input does not contain numbers with a custom string error message.static ValidationRule<String>noNumbers(StyledText errorMessage) Returns a validation rule that checks if the input does not contain numbers with a custom error message.static ValidationRule<String>noSpaces()Returns a validation rule that checks if the input contains spaces.static ValidationRule<String>Returns a validation rule that checks if the input contains spaces with a custom error message.static ValidationRule<String>noSpaces(StyledText errorMessage) Returns a validation rule that checks if the input contains spaces with a custom error message.static ValidationRule<String>Returns a validation rule that checks if the input matches a certain regex.static ValidationRule<String>Returns a validation rule that checks if the input matches a certain regex with a custom string error message.static ValidationRule<String>regex(String regex, StyledText errorMessage) Returns a validation rule that checks if the input matches a certain regex with a custom error message.
-
Constructor Details
-
TextValidationRules
public TextValidationRules()
-
-
Method Details
-
noSpaces
Returns a validation rule that checks if the input contains spaces.- Returns:
- A validation rule that checks if the input contains spaces.
-
noSpaces
Returns a validation rule that checks if the input contains spaces with a custom error message.- Parameters:
errorMessage- The custom error message.- Returns:
- A validation rule that checks if the input contains spaces.
-
noSpaces
Returns a validation rule that checks if the input contains spaces with a custom error message.- Parameters:
errorMessage- The custom error message.- Returns:
- A validation rule that checks if the input contains spaces.
-
minLength
Returns a validation rule that checks if the input is at least a certain length.- Parameters:
length- The minimum length of the input.- Returns:
- A validation rule that checks if the input is at least a certain length.
-
minLength
Returns a validation rule that checks if the input is at least a certain length with a custom string error message.- Parameters:
length- The minimum length of the input.errorMessage- The custom error message.- Returns:
- A validation rule that checks if the input is at least a certain length.
-
minLength
Returns a validation rule that checks if the input is at least a certain length with a custom error message.- Parameters:
length- The minimum length of the input.errorMessage- The custom error message.- Returns:
- A validation rule that checks if the input is at least a certain length.
-
maxLength
Returns a validation rule that checks if the input is at most a certain length.- Parameters:
length- The maximum length of the input.- Returns:
- A validation rule that checks if the input is at most a certain length.
-
maxLength
Returns a validation rule that checks if the input is at most a certain length with a custom string error message.- Parameters:
length- The maximum length of the input.errorMessage- The custom error message.- Returns:
- A validation rule that checks if the input is at most a certain length.
-
maxLength
Returns a validation rule that checks if the input is at most a certain length with a custom error message.- Parameters:
length- The maximum length of the input.errorMessage- The custom error message.- Returns:
- A validation rule that checks if the input is at most a certain length.
-
disallowEmpty
Returns a validation rule that checks if the input is not empty.- Returns:
- A validation rule that checks if the input is not empty.
-
disallowEmpty
Returns a validation rule that checks if the input is not empty with a custom string error message.- Parameters:
errorMessage- The custom error message.- Returns:
- A validation rule that checks if the input is not empty.
-
disallowEmpty
Returns a validation rule that checks if the input is not empty with a custom error message.- Parameters:
errorMessage- The custom error message.- Returns:
- A validation rule that checks if the input is not empty.
-
regex
Returns a validation rule that checks if the input matches a certain regex.- Parameters:
regex- The regex to match.- Returns:
- A validation rule that checks if the input matches a certain regex.
-
regex
Returns a validation rule that checks if the input matches a certain regex with a custom string error message.- Parameters:
regex- The regex to match.errorMessage- The custom error message.- Returns:
- A validation rule that checks if the input matches a certain regex.
-
regex
Returns a validation rule that checks if the input matches a certain regex with a custom error message.- Parameters:
regex- The regex to match.errorMessage- The custom error message.- Returns:
- A validation rule that checks if the input matches a certain regex.
-
noNumbers
Returns a validation rule that checks if the input does not contain numbers.- Returns:
- A validation rule that checks if the input does not contain numbers.
-
noNumbers
Returns a validation rule that checks if the input does not contain numbers with a custom string error message.- Parameters:
errorMessage- The custom error message.- Returns:
- A validation rule that checks if the input does not contain numbers.
-
noNumbers
Returns a validation rule that checks if the input does not contain numbers with a custom error message.- Parameters:
errorMessage- The custom error message.- Returns:
- A validation rule that checks if the input does not contain numbers.
-
alphanumeric
Returns a validation rule that checks if the input is alphanumeric.- Returns:
- A validation rule that checks if the input is alphanumeric.
-
alphanumeric
Returns a validation rule that checks if the input is alphanumeric with a custom string error message.- Parameters:
errorMessage- The custom error message.- Returns:
- A validation rule that checks if the input is alphanumeric.
-
alphanumeric
Returns a validation rule that checks if the input is alphanumeric with a custom error message.- Parameters:
errorMessage- The custom error message.- Returns:
- A validation rule that checks if the input is alphanumeric.
-