validateValue method
Validates the parsed value,
throwing a FormatException if the value is invalid,
or a UsageException
if the value is invalid for other reasons.
Subclasses may override this method to perform specific validations. If they do, they must also call the super implementation.
Implementation
@mustCallSuper
void validateValue(final V value) {
if (allowedValues?.contains(value) == false) {
throw UsageException(
'`$value` is not an allowed value for ${qualifiedString()}', '');
}
customValidator?.call(value);
}