public ActionHandlerDTO() {
}
@JSONCreator
public ActionHandlerDTO(@JSONField(name = "stopPlay") Boolean stopPlay,
@JSONField(name = "removeHint") Boolean removeHint,
@JSONField(name = "actionResponseType") String actionResponseType,
@JSONField(name = "detail") String detail) {
this.stopPlay = stopPlay;
this.removeHint = removeHint;
this.actionResponseType = actionResponseType;
ActionResponseTypeEnum type = ActionResponseTypeEnum.index(actionResponseType);
if (type != null && type.getClazz() != null) {
this.detailDTO = JSON.parseObject(detail, type.getClazz());
}
}
构造方式
JSON.parseObject(text,new TypeReference<Map<String,ActionHandlerDTO>>() {})
会走入默认构造器,不会使用带有@JSONCreator的构造器。
暂无答案!
目前还没有任何答案,快来回答吧!