title: Deserialize JSON with Jackson into Polymorphic Types - A Complete Example is giving me a compile error
body: <p>I am attempting to work through a tutorial from Programmer Bruce that is supposed to allow the deserialization of polymorphic JSON. </p>
  
  <p>The complete list can be found here
  <a href="http://programmerbruce.blogspot.ca/2011/05/deserialize-json-with-jackson-into.html" rel="noreferrer">Programmer Bruce tutorials</a> (Great stuff btw)</p>
  
  <p>I have worked through the first five with no problems but I have hit a snag on the last one (Example 6), which of course is the one I really need to get working.</p>
  
  <p>I am getting the following error at compile time</p>
  
  <blockquote>
    <p>The method readValue(JsonParser, Class) in the type ObjectMapper is not applicable for the arguments (ObjectNode, Class)</p>
  </blockquote>
  
  <p>and it's being caused by the chunk of code</p>
  
  <pre><code>  public Animal deserialize(  
        JsonParser jp, DeserializationContext ctxt)   
        throws IOException, JsonProcessingException  
    {  
      ObjectMapper mapper = (ObjectMapper) jp.getCodec();  
      ObjectNode root = (ObjectNode) mapper.readTree(jp);  
      Class&lt;? extends Animal&gt; animalClass = null;  
      Iterator&lt;Entry&lt;String, JsonNode&gt;&gt; elementsIterator =   
          root.getFields();  
      while (elementsIterator.hasNext())  
      {  
        Entry&lt;String, JsonNode&gt; element=elementsIterator.next();  
        String name = element.getKey();  
        if (registry.containsKey(name))  
        {  
          animalClass = registry.get(name);  
          break;  
        }  
      }  
      if (animalClass == null) return null;  
      return mapper.readValue(root, animalClass);
    }  
  } 
  </code></pre>
  
  <p>Specifically by the line </p>
  
  <blockquote>
    <p>return mapper.readValue(root, animalClass);</p>
  </blockquote>
  
  <p>Has anyone run into this before and if so, was there a solution?</p>
  
  <p>I'd appreciate any help anyone can give
  Thanks in advance
  Jon D.</p>