On Tue, Aug 20, 2019 at 1:03 PM Erik Ramfelt <
erik.r...@gmail.com> wrote:
>
> Hi
>
> If I check the documentation for the keyUsing annotation, it states that it is for methods, fields and constructors. [1] But the documentation at github states that it is for (method, field). [2]
Perhaps confusion here is between Constructor methods vs Constructor parameters?
`@JsonDeserialize` is NOT allowed on Constructor methods themselves
but only on Constructor parameters. But it definitely is allowed on
latter, and further, property `keyUsing` should apply similar to if it
was used on setter-method or field.
> Is it possible to set @JsonDeserialize(keyUsing = classOf[SomeKeyDeserializer]) on a constructor, if so what params would constructor take. Is there any documentation on how to use the keyUsing annotation on a method or constructor?
It would be used on parameter, like:
public MyType(@JsonDeserialize(keyUsing = MyKeyDeserializer.class
@JsonProperty("data") Map<MyType, String> data) { .... }
>
> Is there a way from a reflect.Method obj (method is annotated with JsonDeserialize) to get the deserializers from that method object using jackson, without creating the deserializers manually? I would like to be able to get the deserializer for a reflected method in order to solve a Map[] deserialization problem, where I have annotated a method with the JsonDeserialize.keyUsing. Reasons behind are some what difficult to explain.
I am not sure I understand this question.
-+ 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
jackson-user...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/jackson-user/9a512550-56fc-4b24-8bc7-4be327e2d626%40googlegroups.com.