【fix sonar】CommonProperty文件
This commit is contained in:
+15
-14
@@ -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;
|
||||
|
||||
@@ -16,8 +17,8 @@ public abstract class CommonProperty implements Serializable{
|
||||
|
||||
|
||||
protected String key;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>此关键字的值必须是字符串或数组。如果它是一个数组,那么数组的元素必须是字符串,并且必须是唯一的。
|
||||
* <p>字符串值必须是六种基本类型之一(“null”,“boolean”,“object”,“array”,“number”或“string”),或“integer”,它匹配任何数字,零分数部分。
|
||||
@@ -25,31 +26,31 @@ public abstract class CommonProperty implements Serializable{
|
||||
*
|
||||
*/
|
||||
protected String type;
|
||||
|
||||
|
||||
/**
|
||||
* 对应JsonSchema的enum
|
||||
* <p>该关键字的值必须是一个数组。这个数组应该至少有一个元素。数组中的元素应该是唯一的。如果实例的值等于此关键字的数组值中的某个元素,则实例将对此关键字成功验证。
|
||||
* 数组中的元素可以是任何值,包括null
|
||||
*
|
||||
*
|
||||
* {
|
||||
* "type": "string",
|
||||
* "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;// 展示类型
|
||||
protected String title;//数据库字段备注
|
||||
protected Integer order;//字段显示排序
|
||||
|
||||
|
||||
protected boolean disabled;//是否禁用
|
||||
|
||||
protected String defVal; // 字段默认值
|
||||
@@ -113,7 +114,7 @@ public abstract class CommonProperty implements Serializable{
|
||||
public void setConstant(Object constant) {
|
||||
this.constant = constant;
|
||||
}
|
||||
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
@@ -153,11 +154,11 @@ public abstract class CommonProperty implements Serializable{
|
||||
* @return
|
||||
*/
|
||||
public abstract Map<String,Object> getPropertyJson();
|
||||
|
||||
|
||||
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) {
|
||||
@@ -190,6 +191,6 @@ public abstract class CommonProperty implements Serializable{
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user