What is the format of the @tags? Where should I put them in source code?

Ara Abrahamian

You put @tags in javadoc comments of the program elements (method, class, field, etc). It follows the basic rules of javadoc comments, and a set of xdoclet-specific rules:

  • It starts with /** and ends with */. You can't start it with /* or //, xdoclet doesn't pick those comments.
  • It should be located right before the program element. For example:
     * This is an account bean.
     * @ejb:bean name="bank/Account" type="CMP"
     * @author $Author: Ara $
    public abstract class AccountBean implements EntityBean
        * Deposit money.
        * @ejb:interface-method
       public void deposit(float amount) {
    A common mistake is to put class comments in start of the file, not before the class definition.
  • All xdoclet @tags by default have a namespace identifier in front of them (@ejb: for example), the exception is @todo tag. The @namespace: is followed by the tag name.
  • Tags either have parameters in front of them or not. You should consult the documentation to see which @tags are available and with which parameters. Parameters are in either name="value" format each separated from the other with a white space character, or if the @tag supports at most one parameter by definition, you can abandon the parameter name and specify it like this: @ejb:interface-method "local" which is equal to @ejb:interface-method view-type="local".
  • If the @tag has a lot of parameters in front of it, it's recommended to split it into rows to make it more readable, like this:
    * @ejb:bean name="bank/Account"
    *           type="CMP"
  • If you want to set a value for a tag parameter and the value has a " in it, you should escape it with a , like this:
    * @ejb:bean name="the bean name is "Account""