- 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.
A generic validator, has a method to validate the object and add messages to a
Errors.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:
-
Method Summary
Modifier and TypeMethodDescriptionvoidvalidate(T object, Errors.Collector collector) Validate the object against this class's configuration.
-
Method Details
-
validate
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
-