You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a MenuModel that extends ResourceSupport. The MenuModel inturn contains a Set. The SubMenuModel also extends ResourceSupport.
When I try to marshall / unmarshall the MenuModel, only the first element of the SubMenuModel is attached to the MenuModel and rest of the elements are lost.
Please find below the sample code for recreating the issue,
@JsonInclude(value = Include.NON_NULL)
public class MenuModel extends ResourceSupport implements Serializable{
private static final long serialVersionUID = 1698404814795439732L;
private String name;
private boolean active;
private Set<SubMenuModel> submenus;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Set<SubMenuModel> getSubmenus() {
return submenus;
}
public void setSubmenus(Set<SubMenuModel> submenus) {
this.submenus = submenus;
}
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
}
@JsonInclude(value=Include.NON_NULL)
public class SubMenuModel extends ResourceSupport implements Serializable {
private static final long serialVersionUID = -4096365611186035173L;
private String name;
private boolean active;
@JsonIgnore
private MenuModel menu;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public MenuModel getMenu() {
return menu;
}
public void setMenu(MenuModel menu) {
this.menu = menu;
}
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
}
I am trying to convert the following json to an Object & vice versa and I could find that the second element is lost,
I have a MenuModel that extends ResourceSupport. The MenuModel inturn contains a Set. The SubMenuModel also extends ResourceSupport.
When I try to marshall / unmarshall the MenuModel, only the first element of the SubMenuModel is attached to the MenuModel and rest of the elements are lost.
Please find below the sample code for recreating the issue,
I am trying to convert the following json to an Object & vice versa and I could find that the second element is lost,
sample json:
resulting json:
All the elements are in the SubMenuModel is retained when I remove ResourceSupport.
The text was updated successfully, but these errors were encountered: