What are the merge points? What are they for?

Ara Abrahamian

Merge points (or merge files) are a mechanism XDoclet provides for merging in a user-written file with the template file. It has various uses:

  • Not all class libraries out there use XDoclet @tags. You should be able to add Struts' servlet for example to the web application you're working on using XDoclet. So <deploymentDescriptor/> sub-task of <webdoclet/> (in fact the web_xml.j tempalte file, which is used by <deploymentDescriptor/>) provides a servlets.xml merge points. So you can create a file named servlets.xml and specifiy all not-XDoclet-annotated servlets in it.
  • Putting @tags in code is good for development but sometimes you want to do deployment to various servers for example. Should you modify the @tags each time for each deployment? No, for deployment-oriented activities (for example specifying the table name an EJB maps to) it's better to use merge-points and use different copies of the merge point for different deployments.
  • Merge points provides pluggability. You can use customization merge points to add a customized content to the generated stuff.