xdoclet.tagshandler
Class AbstractProgramElementTagsHandler

java.lang.Object
  extended by xdoclet.template.TemplateTagHandler
      extended by xdoclet.XDocletTagSupport
          extended by xdoclet.tagshandler.AbstractProgramElementTagsHandler
Direct Known Subclasses:
ClassTagsHandler, ConstructorTagsHandler, FieldTagsHandler, JMXTagsHandler, MethodTagsHandler, PackageTagsHandler, ParameterTagsHandler, PropertyTagsHandler, ScriptEngineTagHandler, SpringValidatorTagsHandler, StrutsValidatorTagsHandler, SunONETagsHandler

public abstract class AbstractProgramElementTagsHandler
extends XDocletTagSupport

Version:
$Revision: 1.17 $
Author:
Ara Abrahamian (ara_e@email.com)
created
Oct 15, 2001

Field Summary
protected static java.lang.String currentToken
          The current token.
protected static java.lang.String matchPattern
          Template can use matchPattern as a place where they can put volatile variable.
protected static java.util.StringTokenizer tagTokenizer
          The StringTokenizer object doing the tokenization.
 
Fields inherited from class xdoclet.XDocletTagSupport
FOR_CLASS, FOR_CONSTRUCTOR, FOR_FIELD, FOR_METHOD, PARAMETER_DELIMITER
 
Constructor Summary
AbstractProgramElementTagsHandler()
           
 
Method Summary
protected  java.lang.String checkForWrap(java.lang.String pText)
          A utility method used by firstSentenceDescription to replace end of line by space.
 java.lang.String currentToken(java.util.Properties attributes)
          Returns current token inside forAllClassTagTokens.
protected  java.lang.String exceptionList(java.util.Properties attributes, int forType)
          Return the throws clause of the specified constructor or method declaration.
protected  java.lang.String firstSentenceDescriptionOfCurrentMember(xjavadoc.XMember member)
          Describe what the method does
protected  void forAllMembers(java.lang.String template, java.util.Properties attributes, int forType)
           
protected  void forAllMemberTags(java.lang.String template, java.util.Properties attributes, int forType, java.lang.String resourceKey, java.lang.String[] arguments)
          Describe what the method does
protected  void forAllMemberTagTokens(java.lang.String template, java.util.Properties attributes, int for_type)
          Describe what the method does
static java.util.Collection getAllClasses()
          Utility method to get classes for iteration used by various methods.
static java.lang.String getClassNameFor(xjavadoc.XClass clazz)
          Returns the not-full-qualified name of the specified class without the package name.
static java.lang.String getFullClassNameFor(xjavadoc.XClass clazz)
          Returns the full-qualified name of the current class with the package name.
static java.lang.String getFullSuperclassNameFor(xjavadoc.XClass clazz)
          Returns the full-qualified name of the superclass of the specified class.
protected  char[] getIndentChars(java.util.Properties attributes)
          A utility method to get the blank space characters used for indenting comments.
protected  xjavadoc.XExecutableMember getXExecutableMemberForMemberName(java.lang.String memberName, boolean superclasses, int forType)
          Searches for the XExecutableMember of the member with name methodName and returns it.
protected  xjavadoc.XExecutableMember getXExecutableMemberForMemberName(java.lang.String memberName, int forType)
          Gets the XExecutableMemberForMemberName attribute of the AbstractProgramElementTagsHandler object
protected static boolean hasExecutableMember_OLD(xjavadoc.XClass clazz, java.lang.String executableMemberName, java.lang.String[] parameters, boolean setCurrentExecutableMember, int forType)
           
protected static boolean hasExecutableMember(xjavadoc.XClass clazz, java.lang.String executableMemberName, java.lang.String[] parameters, boolean setCurrentExecutableMember, int forType)
           
protected static java.lang.Object[] makeCopyOfArray(java.lang.Object[] objects)
          Used to protect returned arrays from being modified (sorted, reordered for example).
 java.lang.String matchValue()
          Returns the value of match variable.
protected  java.lang.String memberComment(java.util.Properties attributes, int forType)
          The comment for the current class member of the specified type (field, constructor or method).
 void setMatchValue(java.lang.String template, java.util.Properties attributes)
          Sets the value of match variable.
 java.lang.String skipToken(java.util.Properties attributes)
          Skips current token.
 
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
 

Field Detail

currentToken

protected static java.lang.String currentToken
The current token. Currently forAllParameterTypes and forAllClassTagTokens set it and currentToken returns the value. Tokens are computed for cases where the value should be tokenized by a set of delimiters.


tagTokenizer

protected static java.util.StringTokenizer tagTokenizer
The StringTokenizer object doing the tokenization. It should be shared by different tag implementations, that's why its defined class-level.


matchPattern

protected static java.lang.String matchPattern
Template can use matchPattern as a place where they can put volatile variable. You can set the value somewhere in the template and later use the value.

Constructor Detail

AbstractProgramElementTagsHandler

public AbstractProgramElementTagsHandler()
Method Detail

getClassNameFor

public static java.lang.String getClassNameFor(xjavadoc.XClass clazz)
Returns the not-full-qualified name of the specified class without the package name.

Parameters:
clazz - class
Returns:
classname

getFullClassNameFor

public static java.lang.String getFullClassNameFor(xjavadoc.XClass clazz)
Returns the full-qualified name of the current class with the package name.

Parameters:
clazz - class
Returns:
fully qualified classname

getFullSuperclassNameFor

public static java.lang.String getFullSuperclassNameFor(xjavadoc.XClass clazz)
Returns the full-qualified name of the superclass of the specified class.

Parameters:
clazz - class
Returns:
superclass' fully qualified classname

getAllClasses

public static java.util.Collection getAllClasses()
Utility method to get classes for iteration used by various methods. The result depends on the context: are we within a forAllPackages iteration or not.

Returns:
An array with all classes in that context in it.

hasExecutableMember_OLD

protected static boolean hasExecutableMember_OLD(xjavadoc.XClass clazz,
                                                 java.lang.String executableMemberName,
                                                 java.lang.String[] parameters,
                                                 boolean setCurrentExecutableMember,
                                                 int forType)
                                          throws XDocletException
Parameters:
clazz -
executableMemberName -
parameters -
setCurrentExecutableMember -
forType -
Returns:
Throws:
XDocletException
To do:
Remove. For archeologists only

makeCopyOfArray

protected static java.lang.Object[] makeCopyOfArray(java.lang.Object[] objects)
Used to protect returned arrays from being modified (sorted, reordered for example).

Parameters:
objects - array of objects
Returns:
copy of array

hasExecutableMember

protected static boolean hasExecutableMember(xjavadoc.XClass clazz,
                                             java.lang.String executableMemberName,
                                             java.lang.String[] parameters,
                                             boolean setCurrentExecutableMember,
                                             int forType)
                                      throws XDocletException
Throws:
XDocletException

setMatchValue

public void setMatchValue(java.lang.String template,
                          java.util.Properties attributes)
                   throws XDocletException
Sets the value of match variable.

Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception
doc.tag
type = "block"
doc.param
name = "value" optional = "false" description = "The new value for matchPattern."

matchValue

public java.lang.String matchValue()
                            throws XDocletException
Returns the value of match variable. Match variable serves as a variable for templates, you set it somewhere in template and look it up somewhere else in template.

Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception
doc.tag
type = "content"

currentToken

public java.lang.String currentToken(java.util.Properties attributes)
                              throws XDocletException
Returns current token inside forAllClassTagTokens.

Parameters:
attributes - The attributes of the template tag
Returns:
value of currently processed token
Throws:
XDocletException - Description of Exception
doc.tag
type = "content"

skipToken

public java.lang.String skipToken(java.util.Properties attributes)
                           throws XDocletException
Skips current token. Returns empty string.

Parameters:
attributes - The attributes of the template tag
Returns:
Empty string
Throws:
XDocletException - Description of Exception
doc.tag
type = "content"

getXExecutableMemberForMemberName

protected xjavadoc.XExecutableMember getXExecutableMemberForMemberName(java.lang.String memberName,
                                                                       int forType)
                                                                throws XDocletException
Gets the XExecutableMemberForMemberName attribute of the AbstractProgramElementTagsHandler object

Parameters:
memberName - Describe what the parameter does
forType - Describe what the parameter does
Returns:
The XExecutableMemberForMemberName value
Throws:
XDocletException - Describe the exception

getXExecutableMemberForMemberName

protected xjavadoc.XExecutableMember getXExecutableMemberForMemberName(java.lang.String memberName,
                                                                       boolean superclasses,
                                                                       int forType)
                                                                throws XDocletException
Searches for the XExecutableMember of the member with name methodName and returns it.

Parameters:
memberName -
superclasses - Search superclasses.
forType -
Returns:
The XMethod for the method named value
Throws:
XDocletException

getIndentChars

protected char[] getIndentChars(java.util.Properties attributes)
A utility method to get the blank space characters used for indenting comments. The number of spaces is read from the indent tag attribute. Defaults to zero spaces if no indent attribute is present.

Parameters:
attributes - The attributes of the template tag
Returns:
Array of indent space characters
See Also:
memberComment(java.util.Properties, int), ClassTagsHandler.classComment(java.util.Properties), ClassTagsHandler.classCommentText(java.util.Properties), ClassTagsHandler.classCommentTags(java.util.Properties)

exceptionList

protected java.lang.String exceptionList(java.util.Properties attributes,
                                         int forType)
                                  throws XDocletException
Return the throws clause of the specified constructor or method declaration. If no constructor/method is specified, the current one is used.

Parameters:
attributes - The attributes of the template tag
forType - Constant indicating constructor or method
Returns:
throws clause
Throws:
XDocletException - Describe the exception
See Also:
MethodTagsHandler.exceptionList(java.util.Properties), ConstructorTagsHandler.exceptionList(java.util.Properties)

forAllMemberTagTokens

protected void forAllMemberTagTokens(java.lang.String template,
                                     java.util.Properties attributes,
                                     int for_type)
                              throws XDocletException
Describe what the method does

Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
for_type - Describe what the parameter does
Throws:
XDocletException - Describe the exception

forAllMemberTags

protected void forAllMemberTags(java.lang.String template,
                                java.util.Properties attributes,
                                int forType,
                                java.lang.String resourceKey,
                                java.lang.String[] arguments)
                         throws XDocletException
Describe what the method does

Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
forType - Describe what the parameter does
resourceKey - Describe what the parameter does
arguments - Describe what the parameter does
Throws:
XDocletException - Describe the exception

memberComment

protected java.lang.String memberComment(java.util.Properties attributes,
                                         int forType)
                                  throws XDocletException
The comment for the current class member of the specified type (field, constructor or method).

Parameters:
attributes - The attributes of the template tag
forType - Member type
Returns:
javadoc comment
Throws:
XDocletException - Describe the exception
See Also:
MethodTagsHandler.methodComment(java.util.Properties), FieldTagsHandler.fieldComment(java.util.Properties), ConstructorTagsHandler.constructorComment(java.util.Properties)
To do:
There is similar functionality in xjavadoc.XDoc. Use that instead (needs a little rework to be more flexible).

firstSentenceDescriptionOfCurrentMember

protected java.lang.String firstSentenceDescriptionOfCurrentMember(xjavadoc.XMember member)
                                                            throws XDocletException
Describe what the method does

Parameters:
member - Describe what the parameter does
Returns:
Describe the return value
Throws:
XDocletException - Describe the exception

forAllMembers

protected void forAllMembers(java.lang.String template,
                             java.util.Properties attributes,
                             int forType)
                      throws XDocletException
Parameters:
template - Describe what the parameter does
attributes - Describe what the parameter does
forType - Describe what the parameter does
Throws:
XDocletException - Describe the exception
To do:
the already Set contains XMember objects. equals/hashCode should be defined in XMember and be implemented in all of the implementing classes.

checkForWrap

protected java.lang.String checkForWrap(java.lang.String pText)
A utility method used by firstSentenceDescription to replace end of line by space.

Parameters:
pText - Description of Parameter
Returns:
Description of the Returned Value

http://xdoclet.sourceforge.net/