title: Validate UUID Restful service
body: <p>I have a RESTful service which receives <code>POST</code> request with <code>UUID</code> values and writes them in DB. So the problem is to validate if <code>UUID</code> is valid or not. For this purpose I implemented custom annotation: </p>
  
  <pre><code>@Constraint(validatedBy = {})
  @Target({ElementType.FIELD})
  @Retention(RUNTIME)
  @Pattern(regexp = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[34][0-9a-fA-F]{3}-[89ab][0-9a-fA-F]{3}-[0-9a-fA-F]{12}")
  public @interface validUuid {
  
      String message() default "{invalid.uuid}";
      Class&lt;?&gt;[] groups() default {};
      Class&lt;? extends Payload&gt;[] payload() default {};
  }
  </code></pre>
  
  <p>But for some reason it doesn't work, even if I pass valid <code>UUID</code> I constantly get an exception: </p>
  
  <blockquote>
    <p>javax.validation.UnexpectedTypeException: HV000030: No validator 
      could be found for constraint 'javax.validation.constraints.Pattern' 
      validating type 'java.util.UUID'</p>
  </blockquote>
  
  <p>Are there any options to validate <code>UUID</code> properly?</p>