title: Java create custom validation annotation like @NotNull for method parameters
body: <p>This is Hibernate validation <strong>NOT SPRING</strong></p>
  
  <p>I want to create an annotation such as <code>@Approved</code> that I can use in a method to validate arguments.</p>
  
  <p>For example:</p>
  
  <pre><code>public class SomeClass implements Approvable {
    @Override
    public boolean isApproved(){
      return false;
    }
  }
  </code></pre>
  
  <p>My @Approved annotation would validate the class by returning the <code>isApprovced()</code> result.</p>
  
  <p>Then, when I have a method like:</p>
  
  <p><code>public void sendMessage(@Approved SomeClass someClass){ ... }</code></p>
  
  <p>I would get an error just like if I had a <code>@Valid</code> annotation on a bean that was not valid (i.e. had a null value in a <code>@NotNull</code> field).</p>
  
  <p>I can create an annotation and a <code>ConstraintValidator&lt;Approved, Approvable&gt;</code> but that only works with <code>@Valid</code>.  How do I do this with method parameters and custom annotations?  I can't find an example.</p>