title: Checking if an annotation is of a specific type
body: <p>I am using reflection to see if an annotation that is attached to a property of a class, is of a specific type. Current I am doing:</p>
  
  <pre><code>if("javax.validation.Valid".equals(annotation.annotationType().getName())) {
     ...
  }
  </code></pre>
  
  <p>Which strikes me as a little kludgey because it relies on a string that is a fully-qualified class-name. If the namespace changes in the future, this could cause subtle errors. </p>
  
  <p>I would like to do:</p>
  
  <pre><code>if(Class.forName(annotation.annotationType().getName()).isInstance(
       new javax.validation.Valid()
  )) {
     ...
  }
  </code></pre>
  
  <p>But <code>javax.validation.Valid</code> is an abstract class and cannot be instantiated. Is there a way to simulate <code>instanceof</code> (or basically use <code>isInstance</code>) against an interface or an abstract class?</p>