title: @Pattern annotation for a method parameter
body: <p>I am trying to validate a emailId which is part of a method parameter and a Query param for the rest endpoint. Using the @Pattern annotation in the method parameter is not working. Is there a better way to handle this scenario using annotation</p>
  
  <pre><code>public EmailResponse isEmailRegistered(HttpServletRequest request,
           @RequestParam("emailId") @Valid @Pattern(message = "Email is invalid", regexp = "^.+@.+\\..+$") final String emailId) 
  </code></pre>
  
  <p>I tried the above and it does not work. Because the email Id field is query parameter I cannot wrap it in a object and add validator on it. </p>
  
  <p>I tried wrapping it in a wrapper object as below but to no luck</p>
  
  <pre><code>public EmailResponse isEmailRegistered(HttpServletRequest request,
           @RequestParam("emailId") @Valid final EmailIdWrapper emailId, final BindingResult bindingResult) 
  </code></pre>
  
  <p>EmailId Wrapper class</p>
  
  <pre><code>public class EmailIdWrapper implements Serializable{
  
  @NotNull(message = "Email Id is required")
  @Size(min = 5, max = 50, message = "Invalid length for email")
  @Pattern(message = "Invalid email id", regexp = "^.+@.+\\..+$")
  private String emailId;
  
  public String getEmailId() {
      return emailId;
  }
  
  public void setEmailId(String emailId) {
      this.emailId = emailId;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>With this case I get a conversionnotsupported error which is quite obvious as the url parameter is a string and I am assigning to a object. </p>