Package space.maxus.flare.util
Interface Validator
- All Known Implementing Classes:
CompoundValidator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
An interface that is used to validate text input
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA functional interface that is used to check if a string is valid -
Method Summary
Modifier and TypeMethodDescriptiondefault ValidatorCombines two validators into one, that ensures that both output truedefault ValidatorandMatching(String regex) Combines this validator with a new regex-based validatordefault ValidatorandMatching(Pattern pattern) Combines this validator with a new regex-based validatorbooleanEnsures that input is validstatic @NotNull ValidatorConstructs a validator that matches based on a Regular Expressionstatic @NotNull ValidatorConstructs a validator that matches based on a compiled Regular Expressionstatic @NotNull Validatorof(@NotNull Validator.Checker checker) Constructs a validator based on a manual checker
-
Method Details
-
matching
@Contract("_ -> new") @NotNull static @NotNull Validator matching(@Language("RegExp") @RegEx String regex) Constructs a validator that matches based on a Regular Expression- Parameters:
regex- Regex to match against- Returns:
- A new validator that matches based on the regex
-
matching
Constructs a validator that matches based on a compiled Regular Expression- Parameters:
compiled- Compiled regex to match against- Returns:
- A new validator that matches based on the regex
-
of
Constructs a validator based on a manual checker- Parameters:
checker- Lambda checker to use- Returns:
- A new validator
-
isValid
Ensures that input is valid- Parameters:
input- Input to be checked- Returns:
- True if input is valid, false otherwise
-
and
Combines two validators into one, that ensures that both output true- Parameters:
other- Other validator to be added- Returns:
- A new compound validator
-
andMatching
Combines this validator with a new regex-based validator- Parameters:
regex- Regex for new validator to match against- Returns:
- A new compound validator
-
andMatching
Combines this validator with a new regex-based validator- Parameters:
pattern- Compiled regex for new validator to match against- Returns:
- A new compound validator
-