Tools-Pythom脚本给JavaDto加注解


def json_add_name():
    data = open("Demo.java").readlines()
    outfile = open("DemoFormat.java", "w")
    flag = 0
    for line in data:
        if line.strip().find("}") != -1:
            flag = 0
        if flag == 1:
            if line.strip() != "":
                temp = line.strip().split(";")[0].split(" ")[-1]
                outfile.write("    @ApiModel(value = \"" + temp
                              + "\", example = \"" + temp + "\")" + "\n")
                outfile.write("    @JsonParse(\"" + temp + "\")" + "\n")
        if line.strip().find("{") != -1:
            flag = 1
        outfile.write(line)
    outfile.close()
上一篇:简单的卷积网络


下一篇:CentOS 安装 NET Core SDK