JaVa
   

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:

Many of the these technologies will be covered later in this tutorial 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.


JaVa
   
Comments