XDoclet

from Wikipedia, the free encyclopedia

XDoclet is a tool for attribute-oriented work in Java . It should not be confused with annotations , since XDoclet is not translated into attributes that can be used at runtime by the compiler , but generates Java code that is translated into executable code. These are Javadoc commentaries newly defined using tags expanded and XDoclet- Doclet processed to then generate additional files from the source code in addition to the regular program.

XDoclet is used in particular in the context of J2EE and can - if used correctly - make work much easier for the programmer.

Example: XDoclet in the J2EE context

To create an Enterprise JavaBean (under EJB 2.0), at least the bean implementation and the home interface are required. Depending on your needs, you still need a remote, a local and a local home interface. Depending on the application server, you also need a deployment descriptor, an assembly descriptor or both. The descriptors can differ from application server to application server or even from use to use. In total, the following files are possible:

  • Bean implementation
  • Remote interface
  • Home interface
  • Local interface
  • Local home interface
  • Deployment descriptor
  • Assembly descriptor

With the help of XDoclet, the programmer only has to write the bean implementation himself in the simplest case and add new tags to it. XDoclet then creates the remaining files automatically.

Example headers

This example shows the use of XDoclet tags based on a code fragment from an EJB .

 /**
  * Hier könnte der Kommentar bzw. die Beschreibung der Klasse stehen.
  *
  * XDoclet Anfang
  * @ejb.bean name="NameDerBean"
  * display-name="Bean 123"
  * description="Diese Bean wird für XY verwendet"
  * jndi-name="ejb/NameDerBean"
  * type="Stateless"
  * view-type="both"
  * XDoclet Ende
  */

view

With the introduction of annotations in Java 1.5 , the future of XDoclet is uncertain. Annotations almost completely replace the need for XDoclet, but must first be correctly implemented by the tool manufacturers or third-party providers. Furthermore, it remains to be seen whether the implementations of the manufacturers can be adapted or expanded just as easily and flexibly as is the case with the open source project XDoclet. Porting the XDoclet tags to annotations is relatively easy.

Web links