On Sat, Jun 8, 2019 at 5:42 AM Bojan Tomic <[email protected]> wrote:
>
> Let's say I have a generic interface Inter<T>, configured via 
> @JsonDeserialize(as = Impl.class) to always deserialize as Impl.
> Can I somehow ask Jackson to fully refine the a type into its deserializable 
> version, so that for e.g.  Inter<Inter<Number>> I get Impl<Impl<Number>>?
>
> I'm aware of the following methods that get me halfway there:
>
> DeserializerFactory#mapAbstractType(...)
> AnnotationIntrospector#refineDeserializationType(...)
>
> But with both of these I get Impl<Inter<Number>> and not Impl<Impl<Number>>, 
> i.e. only one level got refined.
> If there a method to get recursively refined type? Also, is any of the 2 
> methods I listed the correct way to refine one level?
> Is this usage even supported or am I hacking at internal stuff here?

Unfortunately I think this is not supported. It gets quite difficult
to support multiple levels of resolution when Annotations only allow
reference to type-erased classes as values.

You may be able to override `refineDeserializationType()` to do what
you want, as you can control the logic using additional information
(as you know bit more about type structure), and doing that would make
sense to me and be supported to the degree that more advanced type
resolution is legit use case.

-+ Tatu +-

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jackson-user/CAL4a10i5G2oSiNK3iHkCDC_qgrBrx46si-8rQsYCTNRLyt7U0w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to