I have these two base classes:
class BasePost {
private String id;
private String creator;
private BasePostMeta postMeta;
}
class BasePostMeta {
private String title;
private String content;
}
And some other that extending them:
class ProjectPost extends BasePost {
private ProjectPostMeta postMeta;
}
class ProjectPostMeta extends BasePostMeta {
private String startDate;
private String endDate;
}
As you can see I will hide the postMeta if I need.
When I tried to serialize it with GSON, I got "multiple fields" warning for postMeta. I've looked into this answer utilizing ExclusionStrategy but it hides the subclass field in favor of superclass field.
How to achieve the other way around?