title: Alternative to Jackson @JsonSubTypes
body: <p>Jackson framework provides annotation based approach to emit the type information during serialization process.</p>
  
  <p>I do not want to use @JsonSubTypes annotation in  my super class(Animal).</p>
  
  <p>Instead I want to tell my  SubClasses i.e Dog and Elephant that Animal is their parent.</p>
  
  <p>Is there any approach to do so without using annotation in Animal class.</p>
  
  <p>If yes, please provide example of to do the same if possible.</p>
  
  <p>Following is case which I am trying to resolve.JSON which "test" receives, contains "type" field as "dog" or "elephant".</p>
  
  <p>I want to register these two classes as subtypes of "Animal" class but don't want to use @JsonSubTypes in Animal.</p>
  
  <p>Any help would be appreciated.
  Thanks in advance.</p>
  
  <pre><code>@JsonTypeInfo( use = JsonTypeInfo.Id.NAME,  include = JsonTypeInfo.As.PROPERTY, property = "type")
  abstract class Animal(){
        private String sound;
        private String type;
  
       //getters and setters
  
  }
  
  @JsonTypeName("dog")
  Class Dog extends Animal(){
       //some attributes.
       //getters and setters
  }
  
  @JsonTypeName("elephant")
  Class Elephant extends Animal(){
       //some attributes.
       //getters and setters
  }
  
  
  @Controller
  public class MyController {
  
      //REST service
      @RequestMapping( value = "test")
      public  @ResponseBody String save(@RequestBody  Animal animal){
  
      System.out.println(animal.getClass());
      return success;
  
      }
  }
  </code></pre>