title: Getting all inner classes by reflection
body: <p>I have the following problem. I have this pretty class and now I want to get all the classes that extend that class (inner classes ) and fill 'classList' with it. ( in an automatic way of course )</p>
  
  <pre><code>public abstract class CompoundReference {
  
      private static List&lt;Class&lt;? extends CompoundReference&gt;&gt; classList
              = new ArrayList&lt;Class&lt;? extends CompoundReference&gt;&gt;();
  
  
      @CompoundKey(gsType = User.class, dbType = UserDetailsMappings.class)
      public static class CUser extends CompoundReference {
      }
  
      @CompoundKey(gsType = Catalog.class, dbType = CatalogDetailsMappings.class)
      public static class CCatalog extends CompoundReference {
      }
  
      @CompoundKey(gsType = Product.class, dbType = ProductDetailsMappings.class)
      public static class CProduct extends CompoundReference {
      }
  
      @CompoundKey(gsType = Category.class)
      public static class CCategory extends CompoundReference {
      }
  
      @CompoundKey(gsType = Poll.class, dbType = PollDetailsMappings.class)
      public static class CPoll extends CompoundReference {
      }
      // much mroe inner classes
  </code></pre>
  
  <p>Some manual solution would be just to main such a static block , that is something that I dont want to do.</p>
  
  <pre><code>  static {
          classList.addAll(Arrays.asList(CUser.class, CCatalog.class,
                  CProduct.class, CCategory.class,
                  CPoll.class, CComment.class, CWebPage.class,
                  CReview.class, CPost.class, CMessage.class, CStory.class,CPicture.class));
  
      }
  </code></pre>