T - type of the object to be validated@FunctionalInterface
public interface Validator<T>
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();
Jwt.validate(java.util.List)| Modifier and Type | Method and Description |
|---|---|
void |
validate(T object,
Errors.Collector collector)
Validate the object against this class's configuration.
|
void validate(T object, Errors.Collector collector)
object - object to validatecollector - collector of error messages to add problems to. Use Errors.Collector#fatal(Object, String)
to mark the validation as a failureCopyright © 2018, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.