title: JSON deserializer with generic type using TypeReference
body: <p>I'm trying to generalise this method:</p>
  
  <pre><code>public EventStream&lt;Greeting&gt; deserialize(String value){
      ObjectMapper mapper = new ObjectMapper();
  
      EventStream&lt;Greeting&gt; data = null;
      try {
          data = new ObjectMapper().readValue(value, new TypeReference&lt;EventStream&lt;Greeting&gt;&gt;() {});
      } catch (IOException e) {
          e.printStackTrace();
      }
      return data;
  }
  </code></pre>
  
  <p>where EventStream is:</p>
  
  <pre><code>public class EventStream&lt;T&gt; {
  
      private EventHeaders headers;
  
      @JsonDeserialize
      private T payload;
  }
  </code></pre>
  
  <p>What I'd like to have is replace the specific Object Greeting with a generic, in the deserialize method.</p>
  
  <p>I tried with this:</p>
  
  <pre><code>public &lt;T&gt; EventStream&lt;T&gt; deserialize(String value){
      ObjectMapper mapper = new ObjectMapper();
  
      EventStream&lt;T&gt; data = null;
      try {
          data = new ObjectMapper().readValue(value, new TypeReference&lt;EventStream&lt;T&gt;&gt;() {});
      } catch (IOException e) {
          e.printStackTrace();
      }
      return data;
  }
  </code></pre>
  
  <p>But the payload inside the EventStream result is deserialized as LinkedHashMap. It seems like TypeReference ignored the generic type.
  Any idea?
  Thanks</p>