If javaslang List implementation is a mutable `List`, you can simply
register abstract type mapping:


  SimpleModule m = new SimpleModule(...);
  m.addAbstractTypeMapping(List.class, SlangList.class);
  mapper.registerModule(m);

-+ Tatu +-



On Thu, Apr 20, 2017 at 5:21 PM, Santhosh Kumar <[email protected]> wrote:
> Posted a question in SO [0]. Question is:
>
> I have a need to map standard Json array to a custom List type (infact not
> java.util.List at all but javaslang.collection.List). Adding to the
> complexity, we don't have static beans where we could define the list type
> as javaslang type but we need to map to generic Map but the list instance
> should be of type javaslang.collection.List.
>
>
> I tried with creating new custom deserializer but since we are trying to
> deser into generic Map, it is not touching that custom deserializer at all.
>
> For ex., here is the test case we are looking to pass.
>
>
> @Test
> @DisplayName("list instance is javaslang list")
> void listAsJsList() throws Exception {
>     Map<String, Object> object = objectMapper.readValue(
>             "{\"records\": [{\"id\": \"123\"}, {\"id\": \"124\"} ] }",
> HashMap.class);
>
> assertThat(object.get("records")).isInstanceOf(javaslang.collection.List.class);
> }
>
>
> Any help is appreciated.
>
>
> [0]
> https://stackoverflow.com/questions/43531918/jackson-custom-list-instance-type
>
> --
> 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].
> For more options, visit https://groups.google.com/d/optout.

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to