public class PatternValidator extends Object implements AttributeValidator
Is capable of validating CharSequences.
| Constructor and Description |
|---|
PatternValidator(String regex)
Constructs a
PatternValidator with the given regular expression. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
int |
hashCode() |
Optional<AttributeValidationReport> |
validate(Attribute attribute)
Validates a single
Attribute. |
public PatternValidator(String regex)
PatternValidator with the given regular expression.regex - the regular expressionIllegalArgumentException - if regex is nullPatternSyntaxException - if regex is not a valid regular
expressionpublic Optional<AttributeValidationReport> validate(Attribute attribute)
Attribute.
Validates only the values of attribute that are CharSequences.
validate in interface AttributeValidatorattribute - the Attribute to validate, cannot be nullOptional containing an AttributeValidationReport if there are
violations, or an empty Optional if there are no violationsThis work is licensed under a Creative Commons Attribution 4.0 International License.