NetBeans IDE XDoclet Hibernate
Project Extensions

the NBXDoclet site
Project Page

XDoclet support for NetBeans


XDoclet is an open source code generation engine. It enables Attribute-Oriented Programming for java. In short, this means that you can add more significance to your code by adding meta data (attributes) to your java sources. This is done in special JavaDoc tags.

XDoclet plugin for NetBeans helps to develop application based on xdoclet in netbeans. Currently it supports:

Tag editing

The definition for xdoclet tags are stored in xml file. It defines where xdoclet's tag should be added. For example ejb related tags can be used within EJB bean (Session, Entity, MessageDriven). There is implemented support for adding new tag and customizing tag. If you want to add definition for other xdoclet's tags look to the ejb.xml (xdoclet.jar/resources/ejb.xml) file for motivation.

Add new tag

Select either classes or methods in Project View. Perform Add Tag action from Tools menu.

The Add tag dialog will be shown.

There you can choose the group of tags in Group combobox. For EJB choose the EJB. For Hibernate choose Hibernate. After the group is selected the Tag Templates list shows available tags which can be added. When is selected a Tag tamplate, short description for it will be shown in text area. The tag will be added after click to Add button.

Customizing Tags

Select either methods or classes in project view. Show Xdoclet view window (Window|XDoclet View). For examle is selected this method:

If the selected method contains xdoclet's tags, the name of tags will be shown in xdoclet view.

There are shown only xdoclet's tags with definition in xml file descriptor.

The attributes of xdoclet tags should be easily customized in property sheet for node of tag (Window|Properties shows property sheet component). There are more reasons why to customize xdoclet's attributes in property sheet. There is description for them. If a value of a attribute is a item from a list the property field will be a combobox. In the definition file should be speciefied a regular expresion for the attribute value. The value will be validated when is typed in the property sheet.

Xml Queries for Xdoclet

The xdoclet tags and attributes are metadata for java methods and classes. In xdoclet module was created query language for queries over these metadata. A query is writen in xml language. The input is for query is a folder in Projects view or File view. The result is shown in standalone explorer view. In ejb.xml are implemented two basic queries.

Show jndi names of EJB beans:

Show defined relations for entity beans with container managed persistence:

How to perform query

  1. Select a folder (java package package) in filesystems.
  2. Perform Tools|XDoclet query action from main menu.
  3. The Xdoclet query dialog is shown. Select EJB group in Groups combo box.
  4. Now you can choose :
    • EntityAndSession query - show all jndi names
    • EJBRelation - show relations between entitties