Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

XDoclet Meets Eclipse: Code Generation Made Easy : Page 3

In an earlier article, you learned how to use an Eclipse plugin that supports XDoclet to administer a JBoss application server. Now, take it to the next level: Learn how to use the XDoclet plugin to generate code via a simple servlet-driven, EJB-based example.


advertisement
Where to Keep Your Generated Code
There are several ways of managing generated source files. Some developers encourage you mix your generated source in with your own source code. We prefer to keep all the generated code in a completely separate source folder. The way that you do it will probably be based on your personal preference and circumstances. As seen in Figure 2, we put the source code in a directory called src and we set up the XDoclet configurations to generate the XDoclet files in a directory called gen_src.

JSR 175
The attribute-oriented programming paradigm has gained a huge amount of attention in the software development community. For example, the C# language has a built-in facility for adding metadata. The Java community is recognizing the need for adding metadata as part of the Java language definition. JSR175 (see http://www.jcp.org/en/jsr/detail?id=175) will allow for "annotating fields, methods, and classes as having particular attributes that indicate they should be processed in special ways by development tools, deployment tools, or run-time libraries. We call such annotations metadata." JSR 175 will implement the equivalent of XDoclet's JavaDoc metadata definition. The XDoclet project will likely adopt the JSR 175 standard for defining metadata, and continue to develop its generation tools using that standard.

In this article you were introduced to XDoclet, a code generation engine which implements a concept known as Attribute-Oriented Programming. XDoclet has found a huge following, as it can reduce the amount of code that a developer must hand write. Though we focused on the ejbdoclet and webdoclet doclets in particular, XDoclet can be used to generate a myriad of other files needed for such leading technologies as JDO and Struts.



Javid Jamae is the president of Jamae Consulting, a software development and consulting firm that provides business, training, and development services to large and small companies. Reach him by e-mail .
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap