You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
871 B
32 lines
871 B
2 years ago
|
package com.ynxbd.wx.wxfactory.menu.result;
|
||
|
|
||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||
|
import com.ynxbd.wx.wxfactory.menu.bean.WxMenu;
|
||
|
import lombok.Getter;
|
||
|
import lombok.NoArgsConstructor;
|
||
|
import lombok.Setter;
|
||
|
import lombok.ToString;
|
||
|
|
||
|
|
||
|
import java.io.IOException;
|
||
|
import java.util.List;
|
||
|
|
||
|
@NoArgsConstructor
|
||
|
@ToString
|
||
|
@Getter
|
||
|
@Setter
|
||
|
public class WxMenuResult {
|
||
|
private WxMenu menu;
|
||
|
private List<WxMenu> conditionalmenu;
|
||
|
|
||
|
public String toJson() throws IOException {
|
||
|
return new ObjectMapper().writeValueAsString(this);
|
||
|
}
|
||
|
|
||
|
public static WxMenuResult fromJson(String json) throws IOException {
|
||
|
ObjectMapper mapper = new ObjectMapper();
|
||
|
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||
|
return mapper.readValue(json, WxMenuResult.class);
|
||
|
}
|
||
|
}
|