title: Jackson/Spring deserialization with generic sub classes
body: <p>First off I am using kotlin and spring.</p>
  
  <p>what I am trying to do is have a filter base class/abstract class/interface which has basically nothing. It should have two children each with their own properties. let me show some code:</p>
  
  <pre><code> abstract class AxisFilter&lt;T : Comparable&lt;T&gt;&gt;()
  
  data class SingleAxisFilter&lt;T : Comparable&lt;T&gt;&gt;(
          val value: T,
          val isAbove: Boolean?,
          val isMatch: Boolean
  ) : AxisFilter&lt;T&gt;()
  
  data class DualAxisFilter&lt;T : Comparable&lt;T&gt;&gt;(
          val lowerBound: T,
          val upperBound: T,
          val isBetween: Boolean,
          val inclusive: Boolean = true
  ) : AxisFilter&lt;T&gt;()
  </code></pre>
  
  <p>I wrote a serilalizer:</p>
  
  <pre><code>class AxisFilterDeserializer&lt;T : Comparable&lt;T&gt;&gt; : JsonDeserializer&lt;AxisFilter&lt;T&gt;&gt;() {
    override fun deserialize(jsonParser: JsonParser, deserializationContext: DeserializationContext): AxisFilter&lt;T&gt; {
      val oc: ObjectCodec = jsonParser.getCodec()
      val node: JsonNode = oc.readTree(jsonParser)
  
      return if(node.has("lowerBound"))
        DualAxisFilter&lt;T&gt;(
                lowerBound = node.get("lowerBound") as T,
                upperBound = node.get("upperBound") as T,
                isBetween = node.get("isBetween") as Boolean,
                inclusive = if(node.has("inclusive")) node.get("inclusive") as Boolean else true)
      else
          SingleAxisFilter&lt;T&gt;(
                  value = node.get("value") as T,
                  isAbove = if(node.has("isAbove")) node.get("isAbove") as Boolean else null,
                  isMatch = node.get("isMatch") as Boolean
          )
    }
  }
  </code></pre>
  
  <p>and tried to use the <code>@JsonDeserialize</code> annotation, but it doesn't work - or I can't seem to make it work.</p>
  
  <p><code>@Type(value = SingleAxisFilter)</code>, <code>@Type(value = DualAxisFilter)</code> also failed because of the generics.</p>
  
  <p>Hope someone can help me with this issue.</p>