All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hn.doc.xyj.domain.DocData Maven / Gradle / Ivy

There is a newer version: 1.0.18
Show newest version
package com.hn.doc.xyj.domain;

import cn.hutool.core.util.RandomUtil;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * 文档请求 或者 响应参数数据
 */
@Data
public class DocData {
    /**
     * id 6位数id
     */
    private String id = RandomUtil.randomString(6);
    /**
     * 是否必须 true or false
     */
    private String require = "true";
    /**
     * 类型
     */
    private String type = "string";
    /**
     * 参数名称
     */
    private String name;

    /**
     * 描述
     */
    private String description;

    /**
     * 子数据
     */
    private List children;


    public DocData(String name) {
        this.name = name;
    }

    public DocData(String name, String description) {
        this.name = name;
        this.description = description;
    }

    public static DocData create(String name, String description) {
        return new DocData(name, description);
    }

    public static DocData create(String name) {
        return new DocData(name);
    }

    public static List createList(DocData... docDatas) {
        List list = new ArrayList<>();
        for (DocData docData : docDatas) {
            list.add(docData);
        }
        return list;
    }

    public void addChildren(DocData... docDatas) {
        if (children == null) {
            children = new ArrayList<>();
        }
        for (DocData docData : docDatas) {
            children.add(docData);
        }
    }

    public void addChildren(List docDatas) {
        children = docDatas;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy