title: Use a ConstraintValidator to validate an object
body: <p>I want to run this past my fellow Java hacks.  See if this seems to be sane enough to you.  There may be a better way to do this but I was thinking: Can I write a dual-purpose ConstraintValidator that can validate a field (an object of some kind) as it is passed into a method and also be used to validate an instance of that object outside of that context while still using annotations?  I came up with the following approach.  Let me know what you think of it.  Use case:</p>
  
  <pre><code>...
  @POST
  public Response retrieveSomething(@Encoded @IsAParamValid MyParamObject myParamObject)
  {
    ...
  }
  </code></pre>
  
  <p>I also want to be able to do this somewhere else in code:</p>
  
  <pre><code>IsAParamValidValidator.validate(myParamObject);
  </code></pre>
  
  <p>without duplicating the logic to do the validation.  Critical here is I want the automatic exception-generating service that using @IsAParamValid in a method call gets me.</p>