xdoclet.tagshandler
Class MergeTagsHandler

java.lang.Object
  extended by xdoclet.template.TemplateTagHandler
      extended by xdoclet.XDocletTagSupport
          extended by xdoclet.tagshandler.MergeTagsHandler

public class MergeTagsHandler
extends XDocletTagSupport

Version:
$Revision: 1.13 $
Author:
Ara Abrahamian (ara_e@email.com)
xdoclet.taghandler
namespace = "Merge"
created
Oct 15, 2001

Field Summary
 
Fields inherited from class xdoclet.XDocletTagSupport
FOR_CLASS, FOR_CONSTRUCTOR, FOR_FIELD, FOR_METHOD, PARAMETER_DELIMITER
 
Constructor Summary
MergeTagsHandler()
           
 
Method Summary
protected  void generateFileUsingTemplate(java.lang.String dest_file, java.lang.String templateFileName)
          A utility method used for generating the dest_file based on template_file template file.
protected  void generateUsingMergedFile(java.lang.String mergeFile, java.lang.String contents)
          Processes the file specified in merge_file_pattern that has the text content contents.
protected  java.lang.String getMergeFileContents(java.lang.String mergeFilePattern)
          A utility method used for merging a file used by tag.
 void ifMergeFileExists(java.lang.String template, java.util.Properties attributes)
          Evaluates the body if the file exists specified by the "file" attribute.
 void merge(java.lang.String template, java.util.Properties attributes)
          Merge contents of the file designated by the file parameter and evaluates the body if the file is not found.
 
Methods inherited from class xdoclet.XDocletTagSupport
delimit, expandClassName, generate, getCurrentClass, getCurrentClassTag, getCurrentConstructor, getCurrentField, getCurrentFieldTag, getCurrentMethod, getCurrentMethodTag, getCurrentPackage, getDocletContext, getEngine, getExpandedDelimitedTagValue, getTagValue, getTagValue, getTagValue, hasHavingClassTag, hasTag, isTagValueEqual, mandatoryParamNotFound, mandatoryTemplateTagParamNotFound, modifiers, popCurrentClass, pushCurrentClass, setCurrentClass, setCurrentClassTag, setCurrentConstructor, setCurrentField, setCurrentFieldTag, setCurrentMethod, setCurrentMethodTag, setCurrentPackage
 
Methods inherited from class xdoclet.template.TemplateTagHandler
getXJavaDoc, setXJavaDoc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MergeTagsHandler

public MergeTagsHandler()
Method Detail

ifMergeFileExists

public void ifMergeFileExists(java.lang.String template,
                              java.util.Properties attributes)
                       throws XDocletException
Evaluates the body if the file exists specified by the "file" attribute.

Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException
doc.tag
type = "block"
doc.param
name = "file" optional = "false" description = "The path to the file to be merged. The * value of this parameter can have {0} in it, if so {0} is replaced with the current class name and system * searches for the file in in mergeDir+packageName directory. {0} is for cases where you want to define and * merge a file per each class."

merge

public void merge(java.lang.String template,
                  java.util.Properties attributes)
           throws XDocletException
Merge contents of the file designated by the file parameter and evaluates the body if the file is not found. It searches for the file in the directory specified by mergeDir configuration parameter.

Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - XDocletException if something goes wrong
doc.tag
type = "block"
doc.param
name = "file" optional = "false" description = "The path to the file to be merged. The * value of this parameter can have {0} in it, if so {0} is replaced with the current class name and system * searches for the file in in mergeDir+packageName directory. {0} is for cases where you want to define and * merge a file per each class.", name = "generateMergedFile" values = "true,false" description = "If true then process the * merged file also, otherwise only merge it and do not process it. True if the default."

getMergeFileContents

protected java.lang.String getMergeFileContents(java.lang.String mergeFilePattern)
A utility method used for merging a file used by tag. If the mergeFilePattern parameter has a {0} in it then the {0} is replaced with the sybolic class name of the current class, and the package structure of the class is prefixed to it. If not search is done for the exact file with the name specified in mergeFilePattern. Both of these two searches search for the file in root directory designated of mergeDir config parameter. It uses xdoclet.util.FileManager to load the file. FileManager caches the content so that subsequent tries to load the file are served from memory, without reloading the file again and again.

Parameters:
mergeFilePattern - The exact file name or a string that has a {0} in it. {0} is substituted by symbolic class name of current class.
Returns:
The content of the text file.
See Also:
merge(java.lang.String,java.util.Properties), PackageTagsHandler.packageNameAsPathFor(xjavadoc.XPackage), ClassTagsHandler.symbolicClassName(), FileManager

generateUsingMergedFile

protected void generateUsingMergedFile(java.lang.String mergeFile,
                                       java.lang.String contents)
                                throws XDocletException
Processes the file specified in merge_file_pattern that has the text content contents. It resets currentLineNum to 0 upon calling generate() and restores it back to its previous value. It also sets and restores templateFile.

Parameters:
mergeFile - The file to be merged
contents - Description of Parameter
Throws:
XDocletException - Description of Exception
See Also:
TemplateEngine.setTemplateURL(java.net.URL)

generateFileUsingTemplate

protected void generateFileUsingTemplate(java.lang.String dest_file,
                                         java.lang.String templateFileName)
                                  throws XDocletException
A utility method used for generating the dest_file based on template_file template file.

Parameters:
dest_file - the path to the destination file prepended by value of the destDir configuration parameter.
templateFileName - the template file name
Throws:
XDocletException - Description of Exception

http://xdoclet.sourceforge.net/