title: Annotation processor: Is there any way to know if annotated class extends a specific class?
body: <p>I want to check if any of annotated classes' ancestors is actually <code>android.support.v4.app.Fragment</code>.</p>
  
  <p>Currently I wrote a recursive method to do that.</p>
  
  <p>I wonder if any better way of doing this?</p>
  
  <p>The main purpose is to restrain my annotation to be added to any classes.</p>
  
  <p>I also use <code>squareup.javapoet</code>.</p>
  
  <pre><code>private boolean isSubClass(TypeElement typeElement, ClassName superClassName) {
      TypeElement superTypeElement = (TypeElement) ((DeclaredType) typeElement.getSuperclass()).asElement();
  
      if (superTypeElement.toString().equals(Object.class.getName())) {
          return false;
      } else if (superTypeElement.toString().equals(superClassName.reflectionName())) {
          return true;
      }
  
      return isSubClass(superTypeElement, superClassName);
  }
  </code></pre>