【fix sonar】CommonProperty文件

This commit is contained in:
梁琦涛
2023-03-03 15:09:40 +08:00
parent 72eca029ad
commit 542f7a67e2
@@ -1,5 +1,6 @@
package com.jero.common.util.jsonschema;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jero.common.system.vo.DictModel;
@@ -36,14 +37,14 @@ public abstract class CommonProperty implements Serializable{
* "enum": ["1", "2", "3"] 需要的话可以通过这个include转一下
* }
*/
protected List<DictModel> include;
protected transient List<DictModel> include;
/**
* 对应JsonSchema的const
* <p>此关键字的值可以是任何类型,包括null。
* 如果实例的值等于关键字的值,则实例将针对此关键字成功验证。
*/
protected Object constant;
protected transient Object constant;
//三个自定义 属性
protected String view;// 展示类型
@@ -157,7 +158,7 @@ public abstract class CommonProperty implements Serializable{
public JSONObject getCommonJson() {
JSONObject json = new JSONObject();
json.put("type", type);
if(include!=null && include.size()>0) {
if(include!=null && !include.isEmpty()) {
json.put("enum", include);
}
if(constant!=null) {
@@ -176,7 +177,7 @@ public abstract class CommonProperty implements Serializable{
}
if(disabled) {
String str = "{\"widgetattrs\":{\"disabled\":true}}";
JSONObject ui = JSONObject.parseObject(str);
JSONObject ui = JSON.parseObject(str);
json.put("ui", ui);
}
if (defVal!=null && defVal.length()>0) {