首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > PHP > jsp/asp/php任何类似的语言生成代码用java。

jsp/asp/php任何类似的语言生成代码用java。

  • 资源大小:3.57 MB
  • 上传时间:2021-06-29
  • 下载次数:0次
  • 浏览次数:1次
  • 资源积分:1积分
  • 标      签: java 代码 语言 生成 任何 类似

资 源 简 介

Introduction Microsoft introduced a nice concept in VS2005. t4 a template engine allows you to generate some code, xml or any other text-based compilation unit from ASP or PHP-like language. Java has plenty of template engines but some are over-complicated and some just not powerful enough, or better say I was not able to find one that worked for me in my current project, so I decided to create one. Details The idea is simple you write your template file like that ``` public class MyGeneratedClass{ <%% for(int i = 0; i < 10; i++){ %> private int mVar<%=i %>; public getMvar<%=i %>(){ return mVar<%=i %>; } public setMvar<%=i %>(int value){ this.mVar<%=i %> = value; } <%% } %> } ``` Save it as template.java And after you run %JAVA_HOME%/bin/java -jar template.jar template.java=MyGeneratedClass.java Y

相 关 资 源

您 可 能 感 兴 趣 的

同 类 别 推 荐

VIP VIP
0.183963s