-
Notifications
You must be signed in to change notification settings - Fork 83
Closed
Milestone
Description
Hi,
I saw your comment in the code (JacksonJaxbJsonProvider.writeTo() method) : /* * This is still not exactly right; should root type be * further specialized with 'value.getClass()'? Let's see * how well this works before trying to come up with more * complete solution. */ rootType = writer.getTypeFactory().constructType(genericType);
so I suppose you already know the issue.
I have two types :
public abstract class Page<E> implements Iterator<E> {
public static final String PREV_PAGE_REL = "prev";
public static final String NEXT_PAGE_REL = "next";
public final Link getPreviousPageLink() {
return getLink(PREV_PAGE_REL);
}
public final Link getNextPageLink() {
return getLink(NEXT_PAGE_REL);
}
abstract Link getLink(String rel);
}
and
@JsonPropertyOrder({ "entities", "links" })
@JsonAutoDetect(fieldVisibility = Visibility.ANY, creatorVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)
public class PageImpl<E> extends Page<E> {
public static final String PAGE_QUERY_PARAM = "page";
public static final String PER_PAGE_QUERY_PARAM = "perPage";
public static final String SORT_QUERY_PARAM = "sort";
private List<E> entities;
@JsonSerialize(contentUsing = JsonLinkSerializer.class)
@JsonDeserialize(contentUsing = JsonLinkDeserializer.class)
private final List<Link> links;
}
My service returns
//Runtime time of page can be either PageImpl or any other sub type I can determine at compile time
Page<Data> page = ...;
return Response.ok(new GenericEntity<Page<Date>>(page) {}).build();
The problem is that the all the annotations I put into PageImpl will not be taken into account for serialization.
Do you already have any fix or workaround ?
Thank you
Metadata
Metadata
Assignees
Labels
No labels