> + * @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.");

Should I just use CharMatcher.toString() instead of printing the error 
description?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-aws/pull/4/files#r13036613

Reply via email to