validate function
Validates the given message according to the constraints defined in Protobuf.
Returns a ValidationError if the message
is invalid, otherwise returns null
.
Implementation
Optional<ValidationError> validate(GeneratedMessage message) {
var validate = theKnownTypes.validatorFor(message);
var error = validate(message);
if (error.constraintViolation.isEmpty) {
return Optional.empty();
}
return Optional.of(error);
}