title: Jackson: programmatically determine subtypes
body: <p>Given an arbitrary <code>Class</code> object, what is the best way to determine the subtypes of that class registered with Jackson?</p>
  
  <p>For example, here's a simple case where classes <code>Lion</code> and <code>Penguin</code> are subtypes of <code>Animal</code>:</p>
  
  <pre><code>@JsonTypeInfo(use = JsonTypeInfo.Id.NAME)
  @JsonSubTypes({
          @JsonSubTypes.Type(Lion.class),
          @JsonSubTypes.Type(Penguin.class)})
  public static abstract class Animal {}
  
  @JsonTypeName("Lion")
  public static class Lion extends Animal {}
  
  @JsonTypeName("Penguin")
  public static class Penguin extends Animal {}
  </code></pre>
  
  <p>My dream function would look like:</p>
  
  <pre><code>List&lt;Class&gt; getSubTypeClasses(Class c) {...}
  </code></pre>
  
  <p>where <code>getSubTypeClasses(Animal.class)</code> would return <code>Lion</code> and <code>Penguin</code>.</p>
  
  <p>If the Jackson API doesn't provide a convenient way to get this information I will read the annotations manually, but it would be nice to know of a technique compatible with <em>any</em> <code>AnnotationIntrospector</code> implementation.</p>