xml生成java代码_在Eclipse中从XML生成Java代码
这正是模型到文本(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代码相关推荐
- eclipse查看mysql代码_在eclipse中查看Android源代码
声明:高手跳过此文章 当我们在eclipse中开发android程序的时候,往往需要看源代码(可能是出于好奇,可能是读源码习惯),那么如何查看Android源代码呢? 比如下面这种情况 图一 假设我们 ...
- ubuntu chrome java插件_在Ubuntu中为Chrome安装Java插件
问题描述 我有JDK,在Ubuntu中一切正常,我是说IDE,一些应用程序,我能够开发和运行项目,但是我在Chrome中收到一条消息:Java(TM) is required to display t ...
- 如何修改was的java路径_在eclipse中修改tomcat的部署路径操作
在eclipse上面部署web项目后,它没有将你的项目文件放到tomcat 的目录下面.而是放在了你的工作目录下面. 你到这里去找:E:\jintao\.metadata\.plugins\org.e ...
- eclipse mysql Xml配置_mysql8.0在eclipse中通过xml文件配置数据库连接池
mysql8.0在eclipse中通过xml文件配置数据库连接池 1.关于Mysql8.0 2.数据库连接池(DBCP) 3.准备工作 4.配置context.xml 5.配置web.xml 6.调用 ...
- ictclas包 java_ICTCLAS分词系统Java调用接口在Eclipse中的安装
ICTCLAS分词系统Java调用接口在Eclipse中的安装 实验环境:JDK1.5.Eclipse3.1.XP操作系统 分词系统Java接口解压包:d:\fenci(http://www.nlp. ...
- OpenCV演示代码以查找图像中的轮廓(附完整代码)
OpenCV演示代码以查找图像中的轮廓 OpenCV演示代码以查找图像中的轮廓 OpenCV演示代码以查找图像中的轮廓 #include "opencv2/imgcodecs.hpp&quo ...
- Spring配置XML本地提示:点击eclipse属性——选择XML Catalog
Spring配置XML本地提示:点击eclipse属性-->选择XML Catalog
- java 详解 搭建 框架_在Eclipse中搭建Struts框架过程详解
虽然用MyEclipse搭建Struts框架是更为便捷的方式,但是用Eclipse可以增强自己对Struts的理解.本文演示了使用Eclipse搭建Struts 1.2框架的过程.此项目实现了简单的功 ...
- 如何在Eclipse中从XSD生成XML
If you work on web services, you must have been using XSD. To test the web service, you need to gene ...
最新文章
- 题解——洛谷 P2680 NOIP提高组 2015 运输计划
- 使用 ThreadLocal 一次解决老大难问题
- 扩展 junit 框架_JUnit 5扩展模型的生命周期
- _Linux 系统挂载数据盘
- mysql myisam key_buffer_size_MyISAM中key_buffer_size的设置_MySQL
- Delphi中使用全局钩子
- 《CATIA V5 从入门到精通(第二版)》——2.3 操作草图(Operation)
- IL -- 手动处理装箱Box
- php7和php5对比
- Matlab中的滤波器
- Java 实现了第三方QQ账号登录(附源码)
- 分布式与微服务☞web组件kafka
- 【XP系统后的声卡问题】
- 利用Python分析新旧页面的A/B测试结果
- 算术平方根的整数部分(简单)*求平方根的三种方法**整数与小数取绝对值*
- 【成长修炼】关于海贼王海军世界观
- 7z和winrar命令行压缩方法
- android 打开微信主界面
- 移动IM产品发展史及趋势预测
- 基于ssm的志愿者招募网站设计与实现-计算机毕业设计源码+LW文档