Code Generation Templating


XDoclet is a tool that requires input files in order to process them and produce some type of output. During the processing of the input files, XDoclet will discover known tags and process the tags using a series of templates. The templates determine what kind of code is produced by specific tags. Obviously, the richer the template, the more code will be generated. The following figure shows an example of the processing taking place with XDoclet.

Of course, XDoclet will need a way to obtain the input files, as we see in the previous figure. Instead of reinventing another preprocessor for XDoclet, the XDoclet team chose to use the power of Ant to trigger the XDoclet process. Through a series of tasks and subtasks , discussed in more detail later, an Ant build script will trigger XDoclet to process specific source files and subsequently generate new code in the form of Java, configuration files, and others. Therefore, all a developer needs to do is provide an Ant task for XDoclet, define specific XDoclet tags within their source code, and sit back as the code is automatically generated.

XDoclet has found support in a variety of different technologies including:

  • Eclipse

  • EJB

  • Hibernate

  • JBoss

  • JDO

  • JMX

  • MockObjects

  • SOAP

  • Servlets

  • Struts

  • WebLogic

Many of the these technologies will be covered later in this book as they pertain directly to XDoclet. Our goal in the remainder of this chapter is to guide you through the basics of using XDoclet so you are ready to apply it.




Professional Java Tools for Extreme Programming
Professional Java Tools for Extreme Programming: Ant, XDoclet, JUnit, Cactus, and Maven (Programmer to Programmer)
ISBN: 0764556177
EAN: 2147483647
Year: 2003
Pages: 228

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net