xdoclet.tags
Class MethodTagsHandler

java.lang.Object
  |
  +--xdoclet.template.TemplateTagHandler
        |
        +--xdoclet.XDocletTagSupport
              |
              +--xdoclet.tags.AbstractProgramElementTagsHandler
                    |
                    +--xdoclet.tags.MethodTagsHandler

public class MethodTagsHandler
extends AbstractProgramElementTagsHandler

Version:
$Revision: 1.27 $
Author:
Ara Abrahamian (ara_e@email.com)

Fields inherited from class xdoclet.tags.AbstractProgramElementTagsHandler
currentToken, matchPattern, tagTokenizer
 
Fields inherited from class xdoclet.XDocletTagSupport
FOR_CLASS, FOR_CONSTRUCTOR, FOR_FIELD, FOR_METHOD, PARAMETER_DELIMITER
 
Constructor Summary
MethodTagsHandler()
           
 
Method Summary
 java.lang.String currentMethodName()
          Returns the current method name.
 java.lang.String exceptionList(java.util.Properties attributes)
          Iterates over all exceptions thrown by the current method and returns a string containing definition of all those exceptions.
 void executeAndRestoreMethod(java.lang.String template, java.util.Properties attributes)
          Evaluate the current block, and then restore the current method before continuing.
 java.lang.String firstSentenceDescriptionOfCurrentMethod()
          Return standard javadoc of current method.
 void forAllClassMethods(java.lang.String template, java.util.Properties attributes)
          Loops through all methods for all classes after first sorting all the methods.
 void forAllMethods(java.lang.String template, java.util.Properties attributes)
          Iterates over all methods of current class and evaluates the body of the tag for each method.
 void forAllMethodTags(java.lang.String template, java.util.Properties attributes)
          Iterates over all tags of current method and evaluates the body of the tag for each method.
 void forAllMethodTagTokens(java.lang.String template, java.util.Properties attributes)
          Iterates over all tokens in current method tag with the name tagName and evaluates the body for every token.
static java.lang.String getMethodNameWithoutPrefixFor(com.sun.javadoc.MethodDoc cur_method)
          Merge with modified SubTask.methodNameWithoutPrefix
static java.lang.String getMethodTypeFor(com.sun.javadoc.MethodDoc method)
           
static java.lang.String getPropertyNameFor(com.sun.javadoc.MethodDoc method)
           
 java.lang.String getterMethod()
          Returns the getter method name for the current method by prefixing the method name with the proper getter prefix.
 java.lang.String getterPrefix()
          Returns 'get' or 'is' getter prefix part of the current method.
static boolean hasMethod(com.sun.javadoc.ClassDoc clazz, java.lang.String methodName, java.lang.String[] parameters, boolean setCurrentMethod)
          Returns true if a method with the specified methodName+parameters is found in the class clazz.
 void ifDoesntHaveMethod(java.lang.String template, java.util.Properties attributes)
          Evaluate the body if current class doesn't have a method with the specified name+parameters.
 void ifDoesntHaveMethodTag(java.lang.String template, java.util.Properties attributes)
          Evaluates the body if current method doesn't have at least one tag with the specified name.
 void ifHasMethod(java.lang.String template, java.util.Properties attributes)
          Evaluate the body if current class has a method with the specified name+parameters.
 void ifHasMethodTag(java.lang.String template, java.util.Properties attributes)
          Evaluates the body if current method has at least one tag with the specified name.
 void ifIsAbstract(java.lang.String template, java.util.Properties attributes)
          Evaluate the body block if current method is abstract.
 void ifIsNotAbstract(java.lang.String template, java.util.Properties attributes)
          Evaluates the body block if current method is not abstract.
 void ifMethodTagValueEquals(java.lang.String template, java.util.Properties attributes)
          Evaluates the body if value for the method tag equals the specified value.
 void ifMethodTagValueNotEquals(java.lang.String template, java.util.Properties attributes)
          Evaluates the body if value for the method tag not equals the specified value.
static boolean isGetter(java.lang.String str)
          Returns true if the str string starts with a getter prefix ("get" or "is").
 java.lang.String methodComment(java.util.Properties attributes)
          The comment for the current method.
 java.lang.String methodName(java.util.Properties attributes)
          Returns the name of the current method.
 java.lang.String methodNameWithoutPrefix()
          Returns the name of the current method without the first three characters.
 java.lang.String methodTagValue(java.util.Properties attributes)
          Iterates over all method tags with the specified tagName for the current method probably inside of a forAllMethodTags body.
 java.lang.String methodType()
          Returns the return type of the current method.
 java.lang.String propertyName()
          Returns the property name extracted from the current method name.
 void setCurrentMethod(java.lang.String template, java.util.Properties attributes)
          Evaluate the body if current class has a method with the specified name+parameters.
 java.lang.String setterMethod()
          Returns the setter method name for the current method by prefixing the method name with a 'set' and removing the getter method's 'get' or 'is' prefixes, if any.
 
Methods inherited from class xdoclet.tags.AbstractProgramElementTagsHandler
checkForWrap, currentToken, exceptionList, forAllMembers, forAllMemberTags, forAllMemberTagTokens, getAllClasses, getClassNameFor, getExecutableMemberDocForMemberName, getExecutableMemberDocForMemberName, getFullClassNameFor, getFullSuperclassNameFor, getIndentChars, hasExecutableMember, ifHasTag_Impl, ifTagValueEquals_Impl, matchValue, memberComment, setMatchValue, skipToken
 
Methods inherited from class xdoclet.XDocletTagSupport
getClassTagValue, getClassTagValue, getConstructorTagValue, getCurrentClass, getCurrentConstructor, getCurrentField, getCurrentMethod, getCurrentPackage, getCurrentTag, getDocletContext, getFieldTagValue, getFieldTagValue, getMethodTagValue, getMethodTagValue, getParameterValue, getParameterValue, getTagValue, getTagValue, getTagValue, invalidParamValueFound, mandatoryParamNotFound, mandatoryTemplateTagParamNotFound, parsePropertyString, popCurrentClass, pushCurrentClass, replaceProperties, setCurrentClass, setCurrentConstructor, setCurrentField, setCurrentMethod, setCurrentPackage, setCurrentTag, tokenizeValue
 
Methods inherited from class xdoclet.template.TemplateTagHandler
generate, getContext, getEngine, getParser, setContext, setEngine, setParser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodTagsHandler

public MethodTagsHandler()
Method Detail

getMethodTypeFor

public static java.lang.String getMethodTypeFor(com.sun.javadoc.MethodDoc method)
                                         throws XDocletException

getMethodNameWithoutPrefixFor

public static java.lang.String getMethodNameWithoutPrefixFor(com.sun.javadoc.MethodDoc cur_method)
Merge with modified SubTask.methodNameWithoutPrefix
Parameters:
cur_method - Description of Parameter
Returns:
Description of the Returned Value

getPropertyNameFor

public static java.lang.String getPropertyNameFor(com.sun.javadoc.MethodDoc method)

isGetter

public static boolean isGetter(java.lang.String str)
Returns true if the str string starts with a getter prefix ("get" or "is").
Parameters:
str - Description of Parameter
Returns:
The Getter value

hasMethod

public static boolean hasMethod(com.sun.javadoc.ClassDoc clazz,
                                java.lang.String methodName,
                                java.lang.String[] parameters,
                                boolean setCurrentMethod)
                         throws XDocletException
Returns true if a method with the specified methodName+parameters is found in the class clazz. The parameters array can be empty, if so any method with any set of parameters is considered equal to the method we're searching for. if not empty all parameters of the method must be equal to the ones specified in parameters array to have "method equality".
Parameters:
clazz - Description of Parameter
methodName - Description of Parameter
parameters - Description of Parameter
setCurrentMethod -  
Returns:
Description of the Returned Value
Throws:
XDocletException -  

getterPrefix

public java.lang.String getterPrefix()
                              throws XDocletException
Returns 'get' or 'is' getter prefix part of the current method. Returns empty string if the method doesn't start with either of the two getter prefixes.
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception

getterMethod

public java.lang.String getterMethod()
                              throws XDocletException
Returns the getter method name for the current method by prefixing the method name with the proper getter prefix.
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception
See Also:
methodNameWithoutPrefix(), setterMethod(), getterPrefix()

setterMethod

public java.lang.String setterMethod()
                              throws XDocletException
Returns the setter method name for the current method by prefixing the method name with a 'set' and removing the getter method's 'get' or 'is' prefixes, if any.
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception
See Also:
methodNameWithoutPrefix(), getterMethod()

setCurrentMethod

public void setCurrentMethod(java.lang.String template,
                             java.util.Properties attributes)
                      throws XDocletException
Evaluate the body if current class has a method with the specified name+parameters. If parameters not specified then any method with the given name and any set of parameters is considered equal to the given method name and so the test result is positive and the body is evaluated. This method change the current method to the one specified.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception
See Also:
ifHasMethod(java.lang.String,java.util.Properties)

methodComment

public java.lang.String methodComment(java.util.Properties attributes)
                               throws XDocletException
The comment for the current method.
Parameters:
attributes - The attributes of the template tag
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception
See Also:
ClassTagsHandler.classComment(java.util.Properties)

exceptionList

public java.lang.String exceptionList(java.util.Properties attributes)
                               throws XDocletException
Iterates over all exceptions thrown by the current method and returns a string containing definition of all those exceptions.
Parameters:
attributes - The attributes of the template tag
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception

ifIsAbstract

public void ifIsAbstract(java.lang.String template,
                         java.util.Properties attributes)
                  throws XDocletException
Evaluate the body block if current method is abstract.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception
See Also:
ifIsNotAbstract(java.lang.String,java.util.Properties)

ifIsNotAbstract

public void ifIsNotAbstract(java.lang.String template,
                            java.util.Properties attributes)
                     throws XDocletException
Evaluates the body block if current method is not abstract.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception
See Also:
ifIsAbstract(java.lang.String,java.util.Properties)

forAllClassMethods

public void forAllClassMethods(java.lang.String template,
                               java.util.Properties attributes)
                        throws XDocletException
Loops through all methods for all classes after first sorting all the methods.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception

forAllMethods

public void forAllMethods(java.lang.String template,
                          java.util.Properties attributes)
                   throws XDocletException
Iterates over all methods of current class and evaluates the body of the tag for each method.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception

ifDoesntHaveMethodTag

public void ifDoesntHaveMethodTag(java.lang.String template,
                                  java.util.Properties attributes)
                           throws XDocletException
Evaluates the body if current method doesn't have at least one tag with the specified name.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception

ifHasMethodTag

public void ifHasMethodTag(java.lang.String template,
                           java.util.Properties attributes)
                    throws XDocletException
Evaluates the body if current method has at least one tag with the specified name.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception

executeAndRestoreMethod

public void executeAndRestoreMethod(java.lang.String template,
                                    java.util.Properties attributes)
                             throws XDocletException
Evaluate the current block, and then restore the current method before continuing.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception

ifMethodTagValueEquals

public void ifMethodTagValueEquals(java.lang.String template,
                                   java.util.Properties attributes)
                            throws XDocletException
Evaluates the body if value for the method tag equals the specified value.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception

ifMethodTagValueNotEquals

public void ifMethodTagValueNotEquals(java.lang.String template,
                                      java.util.Properties attributes)
                               throws XDocletException
Evaluates the body if value for the method tag not equals the specified value.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception

methodTagValue

public java.lang.String methodTagValue(java.util.Properties attributes)
                                throws XDocletException
Iterates over all method tags with the specified tagName for the current method probably inside of a forAllMethodTags body.
Parameters:
attributes - The attributes of the template tag
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception

forAllMethodTags

public void forAllMethodTags(java.lang.String template,
                             java.util.Properties attributes)
                      throws XDocletException
Iterates over all tags of current method and evaluates the body of the tag for each method.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception

forAllMethodTagTokens

public void forAllMethodTagTokens(java.lang.String template,
                                  java.util.Properties attributes)
                           throws XDocletException
Iterates over all tokens in current method tag with the name tagName and evaluates the body for every token.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception

firstSentenceDescriptionOfCurrentMethod

public java.lang.String firstSentenceDescriptionOfCurrentMethod()
                                                         throws XDocletException
Return standard javadoc of current method.
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception

methodType

public java.lang.String methodType()
                            throws XDocletException
Returns the return type of the current method.
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception

methodName

public java.lang.String methodName(java.util.Properties attributes)
                            throws XDocletException
Returns the name of the current method.
Parameters:
attributes - The attributes of the template tag
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception

methodNameWithoutPrefix

public java.lang.String methodNameWithoutPrefix()
                                         throws XDocletException
Returns the name of the current method without the first three characters. Used for cases where the method name without the get/set prefix is needed.
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception

currentMethodName

public java.lang.String currentMethodName()
                                   throws XDocletException
Returns the current method name. Used inside block elements.
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception

propertyName

public java.lang.String propertyName()
                              throws XDocletException
Returns the property name extracted from the current method name. Remove any getter/setter prefix from method name and decapitalize it.
Returns:
Description of the Returned Value
Throws:
XDocletException - Description of Exception

ifHasMethod

public void ifHasMethod(java.lang.String template,
                        java.util.Properties attributes)
                 throws XDocletException
Evaluate the body if current class has a method with the specified name+parameters. If parameters not specified then any method with the given name and any set of parameters is considered equal to the given method name and so the test result is positive and the body is evaluated. This method does not change the current method to the one specified.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception
See Also:
ifDoesntHaveMethod(java.lang.String,java.util.Properties)

ifDoesntHaveMethod

public void ifDoesntHaveMethod(java.lang.String template,
                               java.util.Properties attributes)
                        throws XDocletException
Evaluate the body if current class doesn't have a method with the specified name+parameters. If parameters not specified then any method with the given name and any set of parameters is considered equal to the given method name and so the test result is positive and the body is evaluated.
Parameters:
template - The body of the block tag
attributes - The attributes of the template tag
Throws:
XDocletException - Description of Exception
See Also:
ifHasMethod(java.lang.String,java.util.Properties)