这正是模型到文本(M2T)项目中的JET组件的用途.实际上,您甚至可以使用JET创建项目,.classpath和任何其他文件.

Jet模板如下.请注意,这些模板必须完全按照所示命名.

/templates/main.jet

Let c:iterate tags set the XPath context object.

For 100% compatibility with JET 0.9.x or earlier, remove this statement

--%>

--- traverse input model, performing calculations and storing

--- the results as model annotations via c:set tag

com.lacqui.commands

com.lacqui.commands

- Derive the class name from the name of the command

Command

false

--- traverse annotated model, performing text generation actions

--- such as ws:file, ws:folder and ws:project

/templates/classpath.jet

/templates/project.jet

org.eclipse.jdt.core.javabuilder

org.eclipse.jdt.core.javanature

/templates/class.jet

package ;

public class extends Command {

public ResponseCode execute() {

Server srv = getServer();

if (srv.hasCapability(Capabilities.) == false) {

Log.debug("Attempting non-available capability: ");

}

String = getArgument("");

if ( == null) {

throw new InvalidArgumentException("Require ");

}

String command = "GROUP";

if ( != null) command += " - " + ;

srv.send(command);

return srv.getResponse();

}

}

并使用此模型:

给出一个名为com.lacqui.commands的完整java项目,其中包含三个java文件:

package com.lacqui.commands;

public class ArticleCommand extends Command {

public ResponseCode execute() {

Server srv = getServer();

if (srv.hasCapability(Capabilities.READER) == false) {

Log.debug("Attempting non-available capability: READER");

}

String article-id = getArgument("article-id");

if (article-id == null) {

throw new InvalidArgumentException("Require article-id");

}

String message-id = getArgument("message-id");

String command = "GROUP";

if (article-id != null) command += " -article-id " + article-id;

if (message-id != null) command += " -message-id " + message-id;

srv.send(command);

return srv.getResponse();

}

}

还有这个:

package com.lacqui.commands;

public class GroupCommand extends Command {

public ResponseCode execute() {

Server srv = getServer();

if (srv.hasCapability(Capabilities.LOGGER) == false) {

Log.debug("Attempting non-available capability: LOGGER");

}

if (srv.hasCapability(Capabilities.AUTHENTICATOR) == false) {

Log.debug("Attempting non-available capability: AUTHENTICATOR");

}

String groupname = getArgument("groupname");

if (groupname == null) {

throw new InvalidArgumentException("Require groupname");

}

String command = "GROUP";

if (groupname != null) command += " -groupname " + groupname;

srv.send(command);

return srv.getResponse();

}

}

xml生成java代码_在Eclipse中从XML生成Java代码相关推荐

  1. eclipse查看mysql代码_在eclipse中查看Android源代码

    声明:高手跳过此文章 当我们在eclipse中开发android程序的时候,往往需要看源代码(可能是出于好奇,可能是读源码习惯),那么如何查看Android源代码呢? 比如下面这种情况 图一 假设我们 ...

  2. ubuntu chrome java插件_在Ubuntu中为Chrome安装Java插件

    问题描述 我有JDK,在Ubuntu中一切正常,我是说IDE,一些应用程序,我能够开发和运行项目,但是我在Chrome中收到一条消息:Java(TM) is required to display t ...

  3. 如何修改was的java路径_在eclipse中修改tomcat的部署路径操作

    在eclipse上面部署web项目后,它没有将你的项目文件放到tomcat 的目录下面.而是放在了你的工作目录下面. 你到这里去找:E:\jintao\.metadata\.plugins\org.e ...

  4. eclipse mysql Xml配置_mysql8.0在eclipse中通过xml文件配置数据库连接池

    mysql8.0在eclipse中通过xml文件配置数据库连接池 1.关于Mysql8.0 2.数据库连接池(DBCP) 3.准备工作 4.配置context.xml 5.配置web.xml 6.调用 ...

  5. ictclas包 java_ICTCLAS分词系统Java调用接口在Eclipse中的安装

    ICTCLAS分词系统Java调用接口在Eclipse中的安装 实验环境:JDK1.5.Eclipse3.1.XP操作系统 分词系统Java接口解压包:d:\fenci(http://www.nlp. ...

  6. OpenCV演示代码以查找图像中的轮廓(附完整代码)

    OpenCV演示代码以查找图像中的轮廓 OpenCV演示代码以查找图像中的轮廓 OpenCV演示代码以查找图像中的轮廓 #include "opencv2/imgcodecs.hpp&quo ...

  7. Spring配置XML本地提示:点击eclipse属性——选择XML Catalog

    Spring配置XML本地提示:点击eclipse属性-->选择XML Catalog

  8. java 详解 搭建 框架_在Eclipse中搭建Struts框架过程详解

    虽然用MyEclipse搭建Struts框架是更为便捷的方式,但是用Eclipse可以增强自己对Struts的理解.本文演示了使用Eclipse搭建Struts 1.2框架的过程.此项目实现了简单的功 ...

  9. 如何在Eclipse中从XSD生成XML

    If you work on web services, you must have been using XSD. To test the web service, you need to gene ...

最新文章

  1. 题解——洛谷 P2680 NOIP提高组 2015 运输计划
  2. 使用 ThreadLocal 一次解决老大难问题
  3. 扩展 junit 框架_JUnit 5扩展模型的生命周期
  4. _Linux 系统挂载数据盘
  5. mysql myisam key_buffer_size_MyISAM中key_buffer_size的设置_MySQL
  6. Delphi中使用全局钩子
  7. 《CATIA V5 从入门到精通(第二版)》——2.3 操作草图(Operation)
  8. IL -- 手动处理装箱Box
  9. php7和php5对比
  10. Matlab中的滤波器
  11. Java 实现了第三方QQ账号登录(附源码)
  12. 分布式与微服务☞web组件kafka
  13. 【XP系统后的声卡问题】
  14. 利用Python分析新旧页面的A/B测试结果
  15. 算术平方根的整数部分(简单)*求平方根的三种方法**整数与小数取绝对值*
  16. 【成长修炼】关于海贼王海军世界观
  17. 7z和winrar命令行压缩方法
  18. android 打开微信主界面
  19. 移动IM产品发展史及趋势预测
  20. 基于ssm的志愿者招募网站设计与实现-计算机毕业设计源码+LW文档

热门文章

  1. 抗住 60 亿次攻击,起底阿里云安全的演进之路 | 问底中国 IT 技术演进
  2. 网易易盾升级内容安全体系 发布智能审核管理系统
  3. 多线程编程是后台开发人员的基本功
  4. 谁将赢得 5G 比赛?| 畅言
  5. 微服务架构下,大型银行数据库应用实践
  6. 为什么程序员老在改 Bug,就不能一次改好吗?
  7. 哪些奇葩问题会让程序员抓狂?
  8. 终于,腾讯也要造车了
  9. SpringBoot项目瘦身指南,大厂如何面试看出你的水平
  10. python 怎么样才有output_[学]Python用户手册笔记_4_Input and Output