xdoclet

Class XDocletTagSupport

public abstract class XDocletTagSupport extends TemplateTagHandler

Derives from TemplateTagHandler and adds handy support methods for working with Javadoc Doclet classes.

Version: $Revision: 1.61 $

Author: Dmitri Colebatch (dim@bigpond.net.au)

UNKNOWN: October 12, 2001

Field Summary
static intFOR_CLASS
static intFOR_CONSTRUCTOR
static intFOR_FIELD
static intFOR_METHOD
protected static StringPARAMETER_DELIMITER
Default delimiter used inside a xdoclet tag attribute.
Method Summary
protected static Stringdelimit(String attributeValue, Properties attributes)
protected static StringexpandClassName(String value, Properties attributes)
voidgenerate(String template)
static XClassgetCurrentClass()
Provides the current class in the XDoclet build, or null if there is no current class.
static XTaggetCurrentClassTag()
static XConstructorgetCurrentConstructor()
Provides the current constructor in the XDoclet build, or null if there is no current constructor.
static XFieldgetCurrentField()
Provides the current field in the XDoclet build, or null if there is no current field.
static XTaggetCurrentFieldTag()
static XMethodgetCurrentMethod()
Provides the current method in the XDoclet build, or null if there is no current method.
static XTaggetCurrentMethodTag()
static XPackagegetCurrentPackage()
Provides the current package in the XDoclet build, or null if there is no current package.
protected static DocletContextgetDocletContext()
TemplateEnginegetEngine()
Gets the Engine attribute of the TemplateTagHandler object.
protected static StringgetExpandedDelimitedTagValue(Properties attributes, int forType)
The getExpandedDelimitedTagValue method returns a delimited version with class names expanded if requested of the tag value.
protected static StringgetTagValue(Properties attributes, int forType)
Return the Value of a tag specified in a Properties object.
protected static StringgetTagValue(int forType, String tagName, String paramName, String validValues, String defaultValue, boolean superclasses, boolean mandatory)
Gets the TagValue attribute of the XDocletTagSupport class
protected static StringgetTagValue(int forType, XDoc doc, String tagName, String paramName, String validValues, String defaultValue, boolean superclasses, boolean mandatory)
protected booleanhasHavingClassTag(XClass clazz)
Tests whether the passed class has the tag which is specfied in the havingClassTag attribute of the current subtask.
protected static booleanhasTag(Properties attributes, int forType)
A utility method used by ifHasClassTag/ifDoesntHaveClassTag and ifHasMethodTag/ifDoesntHaveMethodTag, return true if at least one tag exists with the specified name.
protected static booleanisTagValueEqual(Properties attributes, int forType)
A utility method used by ifMethodTagValueEquals/ifMethodTagValueNotEquals and ifClassTagValueEquals/ifClassTagValueNotEquals, return true if the value of the tag/XParameter equals with value.
protected static voidmandatoryParamNotFound(XDoc doc, String paramName, String tagName)
Throws an XDocletException exception to stop the build process.
protected voidmandatoryTemplateTagParamNotFound(String templateTagName, String paramName)
Throws an XDocletException exception to stop the build process.
protected Stringmodifiers(int forType)
Return the modifiers (static, private, etc.) for the current program element of the specified type.
static XClasspopCurrentClass()
Pop the current class off the top of the class stack.
static XClasspushCurrentClass(XClass clazz)
Push the specified class to the top of the current class stack making it effectively the current class.
static voidsetCurrentClass(XClass clazz)
Sets current class to clazz by clearing currentClassStack stack and pushing clazz into top of it.
static voidsetCurrentClassTag(XTag currentTag)
Sets the current class tag.
static voidsetCurrentConstructor(XConstructor constructor)
Set the current constructor.
static voidsetCurrentField(XField field)
Set the current field.
static voidsetCurrentFieldTag(XTag currentTag)
Sets the current field tag.
static voidsetCurrentMethod(XMethod method)
Set the current method.
static voidsetCurrentMethodTag(XTag currentTag)
Sets the current method tag.
static voidsetCurrentPackage(XPackage pakkage)
Set the current package.

Field Detail

FOR_CLASS

public static final int FOR_CLASS

FOR_CONSTRUCTOR

public static final int FOR_CONSTRUCTOR

FOR_FIELD

public static final int FOR_FIELD

FOR_METHOD

public static final int FOR_METHOD

PARAMETER_DELIMITER

protected static final String PARAMETER_DELIMITER
Default delimiter used inside a xdoclet tag attribute.

Method Detail

delimit

protected static String delimit(String attributeValue, Properties attributes)

Parameters: attributeValue Describe what the parameter does attributes Describe what the parameter does

Returns: Describe the return value

UNKNOWN: fix the () equals test, it is not nice. Test : finder Home definition on AccountBean

expandClassName

protected static String expandClassName(String value, Properties attributes)

generate

public void generate(String template)

Parameters: template

Throws: XDocletException

UNKNOWN: throw TemplateException instead

getCurrentClass

public static XClass getCurrentClass()
Provides the current class in the XDoclet build, or null if there is no current class.

Returns: current class

See Also: XDocletTagSupport XDocletTagSupport

getCurrentClassTag

public static XTag getCurrentClassTag()

Returns: The current tag.

getCurrentConstructor

public static XConstructor getCurrentConstructor()
Provides the current constructor in the XDoclet build, or null if there is no current constructor.

Returns: current constructor

See Also: XDocletTagSupport

getCurrentField

public static XField getCurrentField()
Provides the current field in the XDoclet build, or null if there is no current field.

Returns: current field

See Also: XDocletTagSupport

getCurrentFieldTag

public static XTag getCurrentFieldTag()

Returns: The current tag.

getCurrentMethod

public static XMethod getCurrentMethod()
Provides the current method in the XDoclet build, or null if there is no current method.

Returns: current method

See Also: XDocletTagSupport

getCurrentMethodTag

public static XTag getCurrentMethodTag()

Returns: The current tag.

getCurrentPackage

public static XPackage getCurrentPackage()
Provides the current package in the XDoclet build, or null if there is no current package.

Returns: current package

getDocletContext

protected static DocletContext getDocletContext()

Returns: the context object casted to DocletContext

getEngine

public TemplateEngine getEngine()
Gets the Engine attribute of the TemplateTagHandler object.

Returns: The Engine value

getExpandedDelimitedTagValue

protected static String getExpandedDelimitedTagValue(Properties attributes, int forType)
The getExpandedDelimitedTagValue method returns a delimited version with class names expanded if requested of the tag value.

Parameters: attributes a Properties value forType an int value

Returns: a String value

Throws: XDocletException if an error occurs

getTagValue

protected static String getTagValue(Properties attributes, int forType)
Return the Value of a tag specified in a Properties object. This method work on the currentTag object variable, matchs it against the XTag specified in the attributes Properties and returns the value of the specified tag.

Parameters: attributes The attributes of the template tag forType if FOR_CLASS, then a fifth property superclasses is searched, if this is set to true, then the tag is also searched in all superclasses of current class. If forType is set to FOR_METHOD or FOR_CONSTRUCTOR or FOR_FIELD, current method or field is searched for the tag.

Returns: The TagValue value

Throws: XDocletException Description of Exception

getTagValue

protected static String getTagValue(int forType, String tagName, String paramName, String validValues, String defaultValue, boolean superclasses, boolean mandatory)
Gets the TagValue attribute of the XDocletTagSupport class

Parameters: forType Describe what the parameter does tagName Describe what the parameter does paramName Describe what the parameter does validValues Describe what the parameter does defaultValue Describe what the parameter does superclasses Describe what the parameter does mandatory Describe what the parameter does

Returns: The TagValue value

Throws: XDocletException Describe the exception

getTagValue

protected static String getTagValue(int forType, XDoc doc, String tagName, String paramName, String validValues, String defaultValue, boolean superclasses, boolean mandatory)

Parameters: forType doc Describe what the parameter does tagName Describe what the parameter does paramName Describe what the parameter does validValues Describe what the parameter does defaultValue Describe what the parameter does superclasses Describe what the parameter does mandatory Describe what the parameter does

Returns: The TagValue value

Throws: XDocletException Describe the exception

UNKNOWN: (Aslak) maybe this method ought to be moved to xjavadoc.XDoc? Not a big deal though.

hasHavingClassTag

protected boolean hasHavingClassTag(XClass clazz)
Tests whether the passed class has the tag which is specfied in the havingClassTag attribute of the current subtask.

Parameters: clazz the Class to check

Returns: true if the current subtask has no havingClassTag or the passed class has a tag with the same name as the havingClassTag attribute of the current subtask, otherwise false

hasTag

protected static boolean hasTag(Properties attributes, int forType)
A utility method used by ifHasClassTag/ifDoesntHaveClassTag and ifHasMethodTag/ifDoesntHaveMethodTag, return true if at least one tag exists with the specified name.

Parameters: attributes The attributes of the template tag forType

Returns: true if matching tag found

Throws: XDocletException Description of Exception

isTagValueEqual

protected static boolean isTagValueEqual(Properties attributes, int forType)
A utility method used by ifMethodTagValueEquals/ifMethodTagValueNotEquals and ifClassTagValueEquals/ifClassTagValueNotEquals, return true if the value of the tag/XParameter equals with value.

Parameters: attributes The attributes of the template tag forType Describe what the parameter does

Returns: Description of the Returned Value

Throws: XDocletException Description of Exception

mandatoryParamNotFound

protected static void mandatoryParamNotFound(XDoc doc, String paramName, String tagName)
Throws an XDocletException exception to stop the build process. The exception has an informative message to help user find out the cause of the error (not specifying a mandatory parameter for a tag).

Parameters: doc member javadoc reference paramName tag parameter name tagName tag name

Throws: XDocletException Description of Exception

mandatoryTemplateTagParamNotFound

protected void mandatoryTemplateTagParamNotFound(String templateTagName, String paramName)
Throws an XDocletException exception to stop the build process. The exception has an informative message to help user find out the cause of the error (omitting a mandatory parameter on a tag).

Parameters: templateTagName tag name paramName tag parameter name

Throws: XDocletException

modifiers

protected String modifiers(int forType)
Return the modifiers (static, private, etc.) for the current program element of the specified type.

Parameters: forType FOR_XXX type constant

Returns: modifiers

Throws: XDocletException Describe the exception

popCurrentClass

public static XClass popCurrentClass()
Pop the current class off the top of the class stack.

Returns: The class popped off the top of the stack.

See Also: XDocletTagSupport XDocletTagSupport

pushCurrentClass

public static XClass pushCurrentClass(XClass clazz)
Push the specified class to the top of the current class stack making it effectively the current class.

Parameters: clazz The class to push onto the top of the class stack.

Returns: The class on the top of the stack.

See Also: XDocletTagSupport XDocletTagSupport

setCurrentClass

public static void setCurrentClass(XClass clazz)
Sets current class to clazz by clearing currentClassStack stack and pushing clazz into top of it.

Parameters: clazz The class to make the current class

See Also: getCurrentClass

setCurrentClassTag

public static void setCurrentClassTag(XTag currentTag)
Sets the current class tag.

Parameters: currentTag The tag to make the current class tag

setCurrentConstructor

public static void setCurrentConstructor(XConstructor constructor)
Set the current constructor.

Parameters: constructor The constructor to make the current constructor

See Also: XDocletTagSupport

setCurrentField

public static void setCurrentField(XField field)
Set the current field.

Parameters: field The field to make the current field

See Also: XDocletTagSupport

setCurrentFieldTag

public static void setCurrentFieldTag(XTag currentTag)
Sets the current field tag.

Parameters: currentTag The tag to make the current field tag

setCurrentMethod

public static void setCurrentMethod(XMethod method)
Set the current method.

Parameters: method The method to make the current method

See Also: XDocletTagSupport

setCurrentMethodTag

public static void setCurrentMethodTag(XTag currentTag)
Sets the current method tag.

Parameters: currentTag The tag to make the current method tag

setCurrentPackage

public static void setCurrentPackage(XPackage pakkage)
Set the current package.

Parameters: pakkage The package to make the current package

See Also: XDocletTagSupport