xdoclet.tagshandler
Class PackageTagsHandler.PackageSubstitution

java.lang.Object
  extended by xdoclet.tagshandler.PackageTagsHandler.PackageSubstitution
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
PackageTagsHandler

public static class PackageTagsHandler.PackageSubstitution
extends java.lang.Object
implements java.io.Serializable

It's good practice to put interfaces (such as remote/local interfaces, data objects and home interfaces) in a separate "interfaces" package rather than in the EJB bean implementation package. Previous versions of XDoclet dictated this behavior, so if package name of a bean ended with .beans or .ejb interfaces were put into .interfaces package. It's no more the case. You have full control over it. If you don't use a packageSubstitution element, then all interfaces are generated to the same package as the bean implementation class. But if you want to follow the pattern and put interfaces into a separate package you can, by providing the list of package name tails that interfaces of beans inside that packages should be placed into the package you define. For example interfaces of test.ejb.CustomerBean will be placed in test.interfaces by the following packageSubstitution:


<packageSubstitution packages="ejb,beans" substituteWith="interfaces" />

By using the useFirst attribute, you can tell XDoclet to substitute the first occurrence and not the last.
Now if you have a structure like

com.acme.foo.bar.ejb
com.acme.baz.lala.ejb

you want to gather all interfaces under one root/subtree like e.g.

com.acme.interfaces.bar.*
com.acme.interfaces.lala.*

now you can say:
<packagesubstitution packages="foo,baz" substituteWith="interfaces" useFirst="true"/>

See Also:
Serialized Form
created
10. september 2002

Constructor Summary
PackageTagsHandler.PackageSubstitution()
           
 
Method Summary
 java.lang.String getPackages()
          Get the comma-separated list of packages to be substituted.
 java.lang.String getSubstituteWith()
          Get the substitute package name.
 boolean getUseFirst()
          Return the useFirst attribute.
 void setPackages(java.lang.String packages)
          Set the comma-separated list of packages to be substituted.
 void setSubstituteWith(java.lang.String substituteWith)
          Set the substitute package name.
 void setUseFirst(boolean first)
          Specify whether the first occurrence of a package from the list should be substituted, or the last.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PackageTagsHandler.PackageSubstitution

public PackageTagsHandler.PackageSubstitution()
Method Detail

getPackages

public java.lang.String getPackages()
Get the comma-separated list of packages to be substituted.

Returns:
package list

getSubstituteWith

public java.lang.String getSubstituteWith()
Get the substitute package name.

Returns:
package

getUseFirst

public boolean getUseFirst()
Return the useFirst attribute. This attribute specifies if the substitution can only appear at the end of a package (useFirst=false) or also in the middle.

Returns:
boolean

setPackages

public void setPackages(java.lang.String packages)
Set the comma-separated list of packages to be substituted.

Parameters:
packages - The new Packages value

setSubstituteWith

public void setSubstituteWith(java.lang.String substituteWith)
Set the substitute package name.

Parameters:
substituteWith - The new SubstituteWith value

setUseFirst

public void setUseFirst(boolean first)
Specify whether the first occurrence of a package from the list should be substituted, or the last.

Parameters:
first - should the first occurrence be used or not?

http://xdoclet.sourceforge.net/