title: Unmarshalling to a subclass with JAXB
body: <p>I've a JSON something like this:</p>
  
  <pre><code>objects:[{
     id:"p452365",
     type:"photo",
     link:"http://xxx.zz"
  },
  {
     id:"v7833",
     type:"video",
     link:"http://xxx.yy",
     length:"4.12"
  }
  ]
  </code></pre>
  
  <p>In superclass <code>Entity</code>, there're 2 instance variables: id and type. In my extended <code>XmlAdapter</code> class I tried to cast my Entity instances to a subtype for ex. <code>Photo</code></p>
  
  <pre><code>public HashMap&lt;String, List&lt;Column&gt;&gt; unmarshal(Feeds f) throws Exception {
          for(Feed feed : f.getFeeds()){
              System.out.println("Entity id for feed : " + feed.getId());
              for(Entity e:feed.getObjects()){
                  if (e instanceof Photo){
                      // Of course it's not
                  }
              }
          }
          return (HashMap&lt;String, List&lt;Column&gt;&gt;)fm.map(f.getFeeds());
      }
  </code></pre>
  
  <p>Of course e isn't an instanceof Photo, I took a shot there.:)
  What I wanna do is to interfere the JAXB process sometime and unmarshall according to the type value in JSON.I wonder where and how.</p>