您的位置:首页 > 运维架构 > 反向代理

Linux服务器架设笔记-Squid服务器配置

2014-03-18 14:14 295 查看
/**
* Step 3:根据“内容”和“输出路径”导出文件
* @param content 内容
* @param outputPath 输出路径
*/
private void output(String content, String outputBasePath) {
PrintWriter printWriter = null;
try {
printWriter = new PrintWriter(new BufferedWriter(new FileWriter(
outputBasePath)));
printWriter.println(content);
printWriter.flush();
} catch (Exception ex) {
ex.printStackTrace();
} finally {
printWriter.close();
}
}

public void generate() {
String templatePath = "";
String result = "";
String fileName = "";
importBeans();
for (int i = 0; i < templatePaths.length; i++) {
templatePath = templatePaths[i];
if (Util.isNull(templatePath))
continue;
for (Bean bean : beans) {
result = importTemplate(templatePath, bean);
if (templatePath.indexOf(".java") > 0)
fileName = bean.getName()
+ templatePath.substring(templatePath
.lastIndexOf("."));
else
fileName = Util.one2LowerCase(bean.getName())
+ templatePath.substring(templatePath
.lastIndexOf("."));
output(result, outputBasePath + fileName);
}
}
}
}

 bean.java

for (Parameter parameter : parameters) {
this.setA(this.getA()+"this."+parameter.getName()+"="+parameter.getName()+";\n");
this.setB(this.getB()+parameter.getClazz()+" "+parameter.getName()+",");
this.setC(this.getC()+"+\""+parameter.getName()+": \"+this."+parameter.getName()+"\n");
this.setD(this.getD()+"@param "+parameter.getName()+": "+parameter.getClazz()+" "+parameter.getNote()+"\n * ");
}

this.setA(this.getA().substring(0,this.getA().length()-1));
this.setB(this.getB().substring(0,this.getB().length()-1));
this.setC(this.getC().substring(0,this.getC().length()-1));
this.setC("\"{\""+this.getC()+"+\"}\"");
this.setD(this.getD().substring(0,this.getD().length()-4));

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: