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

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

package com.gitee.easyopen.doc;

import java.util.List;

/**
 * 

     ${resultDefinition.name}
     ${resultDefinition.dataType}
     #if(${resultDefinition.dataType} == 'array')
     
        
             #foreach($elDefinition in ${resultDefinition.elements})
             
             #end
       
名称 类型 示例值 描述
${elDefinition.name} ${elDefinition.dataType} ${elDefinition.example} ${elDefinition.description}
#else ${resultDefinition.example} #end ${resultDefinition.description} *
* @author tanghc * */ public class ResultHtmlBuilder { public String buildHtml(ApiDocFieldDefinition definition) { StringBuilder html = new StringBuilder(); html.append("") .append(""+definition.getName()+"") .append(""+definition.getDataType()+"") .append(""+buildExample(definition)+"") .append(""+definition.getDescription()+""); html.append(""); return html.toString(); } protected String buildExample(ApiDocFieldDefinition definition) { StringBuilder html = new StringBuilder(); if(definition.getElements().size() > 0) { html.append("") .append("") .append("") .append("") .append("") .append("") .append(""); List els = definition.getElements(); for (ApiDocFieldDefinition apiDocFieldDefinition : els) { html.append("") .append("") .append("") .append("") .append("") .append(""); } html.append("
名称类型示例值描述
"+apiDocFieldDefinition.getName()+""+apiDocFieldDefinition.getDataType()+""+buildExample(apiDocFieldDefinition)+""+apiDocFieldDefinition.getDescription()+"
"); }else{ html.append(buildExampleValue(definition)); } return html.toString(); } protected String buildExampleValue(ApiDocFieldDefinition definition) { return definition.getExample(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy