Search code examples
javajax-rsibm-mobilefirst

XmlJavaTypeAdapter in MobileFirst 7.1 does not work


Hi I am using Mobile First verison 7.1. I have simple adapter which returns JSON response. Response contains date and I am using LocalDateTime for that. It is not supported by Jax-Rs, so I use XmljavaTypeAdapter.

I've created adapter for LocalDateTime and annotated getter (also tried annotating field itself) with @XmlJavaTypeAdapter annotation:

@XmlJavaTypeAdapter(LocalDateTimeAdapter.class)
public LocalDateTime getDate() {
    return date;
}

For some reason this annotation is ignored.


Solution

  • Found the solution, actually it is using Jackson. I've created Jackson serializer and annotated type with this:

    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime date;