private String[] getComments(Map<String, Object> map, EnumNode node) {
        // 1. 模板引擎解析
        try {
            StringWriter stringWriter = new StringWriter();
            Template template = templates.get(node);
            if (template != null){
                template.process(map, stringWriter);

                String comment = stringWriter.toString();
                stringWriter.close();

                // 需要先清理字符串
                return comment.replaceFirst("^[\\s\\t\\r\\n]*", "").replaceFirst("[\\s\\t\\r\\n]*$", "").split("\n");
            }

        } catch (Exception e) {
            logger.error("freemarker 解析失败！", e);
        }

        return null;
    }
private String[] getComments(Map<String, Object> map, EnumNode node) {
        
        try {
            StringWriter stringWriter = new StringWriter();
            Template template = templates.get(node);
            if (template != null){
                template.process(map, stringWriter);

                String comment = stringWriter.toString();
                stringWriter.close();

                
                return comment.replaceFirst("^[\\s\\t\\r\\n]*", "").replaceFirst("[\\s\\t\\r\\n]*$", "").split("\n");
            }

        } catch (Exception e) {
            logger.error("freemarker 解析失败！", e);
        }

        return null;
    }
private String [ ] getComments ( Map < String , Object > map , EnumNode node ) { // 1. 模板引擎解析 try { StringWriter stringWriter = new StringWriter ( ) ; Template template = templates . get ( node ) ; if ( template != null ) { template . process ( map , stringWriter ) ; String comment = stringWriter . toString ( ) ; stringWriter . close ( ) ; // 需要先清理字符串 return comment . replaceFirst ( "^[\\s\\t\\r\\n]*" , "" ) . replaceFirst ( "[\\s\\t\\r\\n]*$" , "" ) . split ( "\n" ) ; } } catch ( Exception e ) { logger . error ( "freemarker 解析失败！", e); } return null ; }
获取评论
@param map 模板参数
@param node  节点ID
@return
获取评论