> + * @author Roman Coedo
> + */
> +@Singleton
> +public class VaultNameValidator extends Validator<String> {
> +
> + private final static int MIN_LENGTH = 1;
> + private final static int MAX_LENGTH = 255;
> +
> + @Override
> + public void validate(String vaultName) {
> + if (vaultName == null || vaultName.length() < MIN_LENGTH ||
> vaultName.length() > MAX_LENGTH)
> + throw exception(vaultName, "Can't be null or empty. Length must be
> " + MIN_LENGTH + " to " + MAX_LENGTH
> + + " symbols.");
> + CharMatcher range = getAcceptableRange();
> + if (!range.matchesAllOf(vaultName))
> + throw exception(vaultName, "Should have ASCII letters and numbers,
> underscores, hyphens, or periods.");
Now the message is dependent on the result of `getAcceptableRange`. Is there
some way to simply *print* that range here, so that if the range ever changes,
the error message remains accurate automatically?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/4/files#r13034795