-
- Type Parameters:
T
- type of the object to be validated
- All Known Implementing Classes:
Jwt.ExpirationValidator
,Jwt.FieldValidator
,Jwt.IssueTimeValidator
,Jwt.NotBeforeValidator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Validator<T>
A generic validator, has a method to validate the object and add messages to aErrors.Collector
. Simple example:Validator<String> validator = (str, collector) -> { if (null == str) { collector.fatal("String must not be null"); } }; Errors.Collector collector = Errors.collector(); validator.validate("string", collector); // would throw an exception if invalid collector.collect().checkValid();
- See Also:
Jwt.validate(java.util.List)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
validate(T object, Errors.Collector collector)
Validate the object against this class's configuration.
-
-
-
Method Detail
-
validate
void validate(T object, Errors.Collector collector)
Validate the object against this class's configuration.- Parameters:
object
- object to validatecollector
- collector of error messages to add problems to. UseErrors.Collector.fatal(Object, String)
to mark the validation as a failure
-
-