通用代码引擎生成工具 XDoclet 介绍

  在做JavaEE开发时,会涉及到使用各种中间件,有许多中间会使用XML进行配置,典型的如hibernate的实体映射文件,spring的bean的配置文件等等,当然这些配置目前些框架也支持Annotation方式的配置。今天这里一个XDoclet框架,也可以做类似的事,并且是一个通用的代码引擎生成工具。以下介绍来译自其官方的一分钟介绍文档(原文http://xdoclet.codehaus.org/One+Minute+Introduction

  

  XDoclet will parse your source files and generate many artifacts such as XML descriptors and/or source code from it. These files are generated from templates that use the information provided in the source code and its JavaDoc tags.

  XDoclet将解析你的代码源文件并且生成相应的一些文件。这些文件是根据源代码中的一些JavaDoc标记通过模板生成的。

  XDoclet lets you apply Continuous Integration in component-oriented development. Developers should concentrate their editing work on only one Java source file per component.

     XDoclet可以让你在进行基于中间件的开发过程中执行持续集成。这样,开发人员将使他们的精力只放在相关组件的代码编写上。

This approach has several benefits:

使用XDoclet会有以下几点好处:

  1. You don't have to worry about out dating deployment meta-data whenever you touch the code. The deployment meta-data is continuously integrated. 你不需要担心由于你改动相关组件代码时,你对应的配置信息会过时。这个部署工作是可以持续集成的。
  2. Working with only one file per component gives you a better overview of what you're doing. If your component consists of several files, it's easy to lose track. If you have ever written an Enterprise Java Bean, you know what we mean. A single EJB can typically consists of 7 or more files. With XDoclet you only maintain one of them, and the rest is generated. 每个组件你只需关注一个地方。如果你的组件由好几个文件组成,它容易让你出现遗漏。假如你以前开发过EJB,你就会理解我们的含义。
  3. You dramatically reduce development time, and can concentrate on business logic, while XDoclet generates 85% of the code for you 你将大大减少你的开发时间,将更加专注于你的业务逻辑的开发。XDoclet将帮助你生成85%的代码。

Java Open Source Programming(Java 开源编程

Currently XDoclet can only be used as part of the build process utilizing Jakarta Maven or Ant.

当前XDoclet只能利用Maven或Ant来做部分的构建过程。

  Although XDoclet originated as a tool for creating EJBs, it has evolved into a generalpurpose code generation engine. XDoclet consists of a core and a constantly growing number of modules. It is fairly straightforward to write new modules if there is a need for a new kind of component.

  尽管XDoclet起初只是作为一个辅助EJB开发的工具,但是它现在已经发展成一个通用代码生成引擎。XDoclet由一个内核和一些插件组成。如时你想为一个Java EE的组件写一个新的插件是非常容易的。

  XDoclet comes with a set of modules for generation of different kinds of files. Users and contributors can write their own modules (or modify existing ones) if they wish to extend the functionality of XDoclet.

  XDoclet在运行时,会通过一系列的插件来生成各类不同的文件。用户可以发布他们自己写的插件或者编辑已存在的插件来进行功能的扩展。

 

你可能感兴趣的:(代码)