User: d_jencks
  Date: 02/02/28 08:17:18

  Modified:    core/src/xdoclet/tags ParameterTagsHandler.java
  Log:
  Added ability to get to descriptions of parameters
  
  Revision  Changes    Path
  1.7       +84 -19    xdoclet/core/src/xdoclet/tags/ParameterTagsHandler.java
  
  Index: ParameterTagsHandler.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/tags/ParameterTagsHandler.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- ParameterTagsHandler.java 6 Feb 2002 00:22:53 -0000       1.6
  +++ ParameterTagsHandler.java 28 Feb 2002 16:17:17 -0000      1.7
  @@ -1,6 +1,8 @@
   package xdoclet.tags;
   
  +import com.sun.javadoc.ExecutableMemberDoc;
   import com.sun.javadoc.Parameter;
  +import com.sun.javadoc.ParamTag;
   import com.sun.javadoc.ProgramElementDoc;
   import xdoclet.XDocletException;
   import xdoclet.util.DocletUtil;
  @@ -11,7 +13,7 @@
   /**
    * @author    Ara Abrahamian ([EMAIL PROTECTED])
    * @created   Oct 15, 2001
  - * @version   $Revision: 1.6 $
  + * @version   $Revision: 1.7 $
    */
   public class ParameterTagsHandler extends AbstractProgramElementTagsHandler
   {
  @@ -24,6 +26,14 @@
        protected static Parameter currentMethodParameter;
   
        /**
  +      * The <code>currentMethodParamTag</code> holds the current ParamTag
  +      * corresponding to the current Parameter.
  +      *
  +      * @see   #forAllMethodParams(java.lang.String)
  +      */
  +     protected static ParamTag currentMethodParamTag;
  +
  +     /**
         * Returns the type of the current method parameter, current method parameter
         * is set inside a forAllMethodParams tag in each iteration.
         *
  @@ -37,6 +47,25 @@
        }
   
        /**
  +      * The <code>methodParamDescription</code> method returns the comment text
  +      * associated with the ParamTag for the current Parameter
  +      *
  +      * @return                      a <code>String</code> value
  +      * @exception XDocletException  if an error occurs
  +      * @doc:tag                     type="content"
  +      */
  +     public String methodParamDescription() throws XDocletException
  +     {
  +             if( currentMethodParamTag == null )
  +             {
  +                     return "no description";
  +             }
  +             // end of if ()
  +
  +             return currentMethodParamTag.parameterComment();
  +     }
  +
  +     /**
         * Returns the name of the current method parameter, current method parameter
         * is set inside a forAllMethodParams tag in each iteration.
         *
  @@ -46,7 +75,7 @@
         */
        public String methodParamName() throws XDocletException
        {
  -             return currentMethodParameter.name().toString();
  +             return currentMethodParameter.name();
        }
   
        /**
  @@ -59,14 +88,25 @@
         */
        public void forAllMethodParams( String template ) throws XDocletException
        {
  -             Parameter[] parameters = getCurrentMethod().parameters();
  -
  -             for( int k = 0; k < parameters.length; k++ )
  -             {
  -                     currentMethodParameter = parameters[k];
  -
  -                     generate( template );
  -             }
  +             forAllParams( getCurrentMethod(), template );
  +             /*
  +              * Parameter[] parameters = getCurrentMethod().parameters();
  +              * ParamTag[] paramTags = getCurrentMethod().paramTags();
  +              * for( int k = 0; k < parameters.length; k++ )
  +              * {
  +              * currentMethodParameter = parameters[k];
  +              * currentMethodParamTag = null;
  +              * for ( int j = 0; j < paramTags.length; j++)
  +              * {
  +              * if (currentMethodParameter.getName().equals(paramTags[j].getName()))
  +              * {
  +              * currentMethodParamTag = paramTags[j];
  +              * break;
  +              * } // end of if ()
  +              * } // end of for ()
  +              * generate( template );
  +              * }
  +              */
        }
   
        /**
  @@ -79,16 +119,16 @@
         */
        public void forAllConstructorParams( String template ) throws XDocletException
        {
  -             Parameter[] parameters = getCurrentConstructor().parameters();
  -
  -             for( int k = 0; k < parameters.length; k++ )
  -             {
  -                     currentMethodParameter = parameters[k];
  -
  -                     generate( template );
  -             }
  +             forAllParams( getCurrentConstructor(), template );
  +             /*
  +              * Parameter[] parameters = getCurrentConstructor().parameters();
  +              * for( int k = 0; k < parameters.length; k++ )
  +              * {
  +              * currentMethodParameter = parameters[k];
  +              * generate( template );
  +              * }
  +              */
        }
  -
        /**
         * Iterates over all exceptions thrown by the current method and returns a
         * string containing definition of all those parameters.
  @@ -173,5 +213,30 @@
                }
   
                currentToken = old_token;
  +     }
  +
  +     private void forAllParams( ExecutableMemberDoc member, String template ) 
throws XDocletException
  +     {
  +             Parameter[] parameters = member.parameters();
  +             ParamTag[] paramTags = member.paramTags();
  +
  +             for( int k = 0; k < parameters.length; k++ )
  +             {
  +                     currentMethodParameter = parameters[k];
  +                     currentMethodParamTag = null;
  +                     for( int j = 0; j < paramTags.length; j++ )
  +                     {
  +                             if( currentMethodParameter.name().equals( 
paramTags[j].parameterName() ) )
  +                             {
  +                                     currentMethodParamTag = paramTags[j];
  +                                     break;
  +                             }
  +                             // end of if ()
  +
  +                     }
  +                     // end of for ()
  +
  +                     generate( template );
  +             }
        }
   }
  
  
  

_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to