xdoclet.tagshandler

Class 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

Method Summary

protected void
generateFileUsingTemplate(String dest_file, String templateFileName)
A utility method used for generating the dest_file based on template_file template file.
protected void
generateUsingMergedFile(String mergeFile, String contents)
Processes the file specified in merge_file_pattern that has the text content contents.
protected String
getMergeFileContents(String mergeFilePattern)
A utility method used for merging a file used by tag.
void
ifMergeFileExists(String template, Properties attributes)
Evaluates the body if the file exists specified by the "file" attribute.
void
merge(String template, 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, hasTag, isTagValueEqual, mandatoryParamNotFound, mandatoryTemplateTagParamNotFound, modifiers, popCurrentClass, pushCurrentClass, setCurrentClass, setCurrentClassTag, setCurrentConstructor, setCurrentField, setCurrentFieldTag, setCurrentMethod, setCurrentMethodTag, setCurrentPackage

Methods inherited from class xdoclet.template.TemplateTagHandler

getXJavaDoc, setXJavaDoc

Method Details

generateFileUsingTemplate

protected void generateFileUsingTemplate(String dest_file,
                                         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

generateUsingMergedFile

protected void generateUsingMergedFile(String mergeFile,
                                       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:
xdoclet.template.TemplateEngine.setTemplateURL(java.net.URL)

getMergeFileContents

protected String getMergeFileContents(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.

ifMergeFileExists

public void ifMergeFileExists(String template,
                              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
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(String template,
                  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."