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

com.gitee.easyopen.doc.ApiDocItem Maven / Gradle / Ivy

package com.gitee.easyopen.doc;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.util.List;

/**
 * 接口内容
 *
 * @author tanghc
 */
public class ApiDocItem implements Orderable {

    private static Gson gson = new GsonBuilder()
            .serializeNulls()
            // 格式化
            .setPrettyPrinting()
            .create();

    private String name;
    private String version;
    private String description;
    private String remark;
    private int order;

    private List paramDefinitions;
    private List resultDefinitions;
    /**
     * 单值返回
     */
    private ApiDocReturnDefinition apiDocReturnDefinition;

    private Object paramData;
    private Object resultData;

    private boolean customWrapper;

    public String getNameVersion() {
        return this.name + this.version;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public List getParamDefinitions() {
        return paramDefinitions;
    }

    public void setParamDefinitions(List paramDefinitions) {
        this.paramDefinitions = paramDefinitions;
    }

    public List getResultDefinitions() {
        return resultDefinitions;
    }

    public void setResultDefinitions(List resultDefinitions) {
        this.resultDefinitions = resultDefinitions;
    }

    @Override
    public int getOrder() {
        return order;
    }

    @Override
    public String getOrderName() {
        return this.getNameVersion();
    }

    public void setOrder(int order) {
        this.order = order;
    }

    public boolean isCustomWrapper() {
        return customWrapper;
    }

    public void setCustomWrapper(boolean customWrapper) {
        this.customWrapper = customWrapper;
    }

    public ApiDocReturnDefinition getApiDocReturnDefinition() {
        return apiDocReturnDefinition;
    }

    public void setApiDocReturnDefinition(ApiDocReturnDefinition apiDocReturnDefinition) {
        this.apiDocReturnDefinition = apiDocReturnDefinition;
    }

    public boolean isSingleReturn() {
        return apiDocReturnDefinition != null;
    }

    public String getParamData() {
        return gson.toJson(paramData);
    }

    public void setParamData(Object paramData) {
        this.paramData = paramData;
    }

    public String getResultData() {
        return gson.toJson(resultData);
    }

    public Object fatchResultData() {
        return this.resultData;
    }

    public void setResultData(Object resultData) {
        this.resultData = resultData;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy