User: rinkrank
  Date: 02/04/03 16:27:49

  Modified:    core/src/xdoclet/jmx/tags JMXTagsHandler.java
  Log:
  Re-enabled the beautifier (which I turned off during xjavadoc refactoring)
  
  Revision  Changes    Path
  1.7       +199 -118  xdoclet/core/src/xdoclet/jmx/tags/JMXTagsHandler.java
  
  Index: JMXTagsHandler.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/jmx/tags/JMXTagsHandler.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- JMXTagsHandler.java       24 Mar 2002 17:44:19 -0000      1.6
  +++ JMXTagsHandler.java       4 Apr 2002 00:27:49 -0000       1.7
  @@ -1,3 +1,38 @@
  +/*
  + * Copyright (c) 2001, Aslak Helles�y, BEKK Consulting
  + * All rights reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without modification,
  + * are permitted provided that the following conditions are met:
  + *
  + * - Redistributions of source code must retain the above copyright notice,
  + *   this list of conditions and the following disclaimer.
  + *
  + * - Redistributions in binary form must reproduce the above copyright
  + *   notice, this list of conditions and the following disclaimer in the
  + *   documentation and/or other materials provided with the distribution.
  + *
  + * - Neither the name of BEKK Consulting nor the names of its
  + *   contributors may be used to endorse or promote products derived from
  + *   this software without specific prior written permission.
  + *
  + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
  + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  + * DAMAGE.
  + */
  +
  +/*
  + * Change log
  + *
  + */
   package xdoclet.jmx.tags;
   
   import xjavadoc.*;
  @@ -19,13 +54,12 @@
    * @author    Jerome Bernard ([EMAIL PROTECTED])
    * @author    Ara Abrahamian ([EMAIL PROTECTED])
    * @created   31 January 2002
  - * @version   $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    * @todo      attributes - XXX: Does this need to be synchronized?
  - * @todo      ifIsGetterMethod, ifIsSetterMethod - TODO: There is a big overlap
  - *      here with stuff in ejb - have a look.
  + * @todo ifIsGetterMethod, ifIsSetterMethod - TODO: There is a big overlap here
  + *      with stuff in ejb - have a look.
    */
  -public class JMXTagsHandler extends AbstractProgramElementTagsHandler
  -{
  +public class JMXTagsHandler extends AbstractProgramElementTagsHandler {
        /**
         * For use in extracting method names.
         */
  @@ -41,36 +75,38 @@
         */
        protected int      index = 0;
   
  +
        /**
         * Returns the MBean name for the current class. Looks for the name parameter
         * in the jmx:mbean tag on the current class.
         *
         * @return                      Description of the Returned Value
         * @exception XDocletException  Description of Exception
  -      * @doc:tag                     type="content" description="Returns the MBean
  -      *      name for the current class. Looks for the name parameter in the
  -      *      jmx:mbean tag on the current class."
  +      * @doc:tag type="content" description="Returns the MBean name for the current
  +      *      class. Looks for the name parameter in the jmx:mbean tag on the current
  +      *      class."
         * @see                         #getMBeanName
         */
  -     public String mbeanName() throws XDocletException
  -     {
  +     public String mbeanName() throws XDocletException {
                return getMBeanName( getCurrentClass() );
        }
   
  +
        /**
         * TODO: There is a big overlap here with stuff in ejb - have a look.
         *
         * @param template
         * @param attributes
         * @exception XDocletException
  -      * @doc:tag                     type="block" description="Executes the block if
  -      *      the current method is a getter"
  +      * @doc:tag type="block" description="Executes the block if the current method
  +      *      is a getter"
         */
  -     public void ifIsGetterMethod( String template, Properties attributes ) throws 
XDocletException
  -     {
  -             if( isGetterMethod() )
  +     public void ifIsGetterMethod(String template, Properties attributes) throws 
XDocletException {
  +             if (isGetterMethod()) {
                        generate( template );
        }
  +     }
  +
   
        /**
         * TODO: There is a big overlap here with stuff in ejb - have a look.
  @@ -78,14 +114,15 @@
         * @param template
         * @param attributes
         * @exception XDocletException
  -      * @doc:tag                     type="block" description="Executes the block if
  -      *      the current method is a setter"
  +      * @doc:tag type="block" description="Executes the block if the current method
  +      *      is a setter"
         */
  -     public void ifIsSetterMethod( String template, Properties attributes ) throws 
XDocletException
  -     {
  -             if( isSetterMethod() )
  +     public void ifIsSetterMethod(String template, Properties attributes) throws 
XDocletException {
  +             if (isSetterMethod()) {
                        generate( template );
        }
  +     }
  +
   
        /**
         * @param template
  @@ -93,8 +130,7 @@
         * @exception XDocletException
         * @doc:tag                     type="block"
         */
  -     public void ifHasAttributeDescription( String template, Properties attributes 
) throws XDocletException
  -     {
  +     public void ifHasAttributeDescription(String template, Properties attributes) 
throws XDocletException {
                boolean hasGetterMethod = false;
                String name = handler.methodNameWithoutPrefix();
                String description = getTagValue(
  @@ -109,55 +145,80 @@
   
                XMethod[] methods = getCurrentClass().methods();
   
  -             for( int i = 0; i < methods.length; i++ )
  -             {
  -                     if( methods[i].name().equals( "get" + name ) || 
methods[i].name().equals( "is" + name ) )
  +             for (int i = 0; i < methods.length; i++) {
  +                     if (methods[i].name().equals("get" + name) || 
methods[i].name().equals("is" + name)) {
                                hasGetterMethod = true;
                }
  +             }
   
  -             if( ( isSetterMethod() && !hasGetterMethod ) || isGetterMethod() )
  -             {
  +             if ((isSetterMethod() && !hasGetterMethod) || isGetterMethod()) {
                        attributes.put( name, description );
                        generate( template );
                }
        }
   
  -     public void forAllIndexedMethodParams( String template, Properties attributes 
) throws XDocletException
  -     {
  +
  +     /**
  +      * Describe what the method does @todo-javadoc Write javadocs for method
  +      *
  +      * @param template Describe what the parameter does @todo-javadoc Write
  +      *      javadocs for method parameter
  +      * @param attributes Describe what the parameter does @todo-javadoc Write
  +      *      javadocs for method parameter
  +      * @exception XDocletException Describe the exception @todo-javadoc Write
  +      *      javadocs for exception
  +      */
  +     public void forAllIndexedMethodParams(String template, Properties attributes) 
throws XDocletException {
                XTag[] tags = getCurrentMethod().doc().tags( 
"jmx:managed-operation-parameter" );
   
                index = 0;
                // Aslak: should i really start with 1 and not 0? This deserves a 
comment.
  -             for( int i = 1; i < tags.length; i++ )
  -             {
  +             for (int i = 1; i < tags.length; i++) {
                        generate( template );
                        index++;
                }
        }
   
  -     public void forAllIndexedConstructorParams( String template, Properties 
attributes ) throws XDocletException
  -     {
  +
  +     /**
  +      * Describe what the method does @todo-javadoc Write javadocs for method
  +      *
  +      * @param template Describe what the parameter does @todo-javadoc Write
  +      *      javadocs for method parameter
  +      * @param attributes Describe what the parameter does @todo-javadoc Write
  +      *      javadocs for method parameter
  +      * @exception XDocletException Describe the exception @todo-javadoc Write
  +      *      javadocs for exception
  +      */
  +     public void forAllIndexedConstructorParams(String template, Properties 
attributes) throws XDocletException {
                XTag[] tags = getCurrentConstructor().doc().tags( 
"jmx:managed-constructor-parameter" );
   
                index = 0;
                // Aslak: should i really start with 1 and not 0? This deserves a 
comment.
  -             for( int i = 1; i < tags.length; i++ )
  -             {
  +             for (int i = 1; i < tags.length; i++) {
                        generate( template );
                        index++;
                }
        }
   
  +
        /**
  -      * @todo refactor common code with indexedConstructorParamValue into a private 
method
  +      * @todo refactor common code with indexedConstructorParamValue into a private
  +      *      method
  +      * @param attributes Describe what the parameter does @todo-javadoc Write
  +      *      javadocs for method parameter
  +      * @return Describe the return value @todo-javadoc Write javadocs for return
  +      *      value
  +      * @exception XDocletException Describe the exception @todo-javadoc Write
  +      *      javadocs for exception
         */
  -     public String indexedMethodParamValue( Properties attributes ) throws 
XDocletException
  -     {
  +     public String indexedMethodParamValue(Properties attributes) throws 
XDocletException {
                String tagName = attributes.getProperty( "tagName" );
                String paramName = attributes.getProperty( "paramName" );
   
  -             if( tagName == null || paramName == null )
  +             if (tagName == null || paramName == null) {
                        throw new XDocletException( Translator.getString( 
"xdoclet.jmx.Messages", "missing_attribute" ) );
  +             }
                XTag[] tags = getCurrentMethod().doc().tags(tagName );
                String tagContent = tags[index].value();
                int begin = tagContent.indexOf( paramName + "=\"" ) + 
paramName.length() + 2;
  @@ -166,13 +227,24 @@
                return tagContent.substring( begin, end );
        }
   
  -     public String indexedConstructorParamValue( Properties attributes ) throws 
XDocletException
  -     {
  +
  +     /**
  +      * Describe what the method does @todo-javadoc Write javadocs for method
  +      *
  +      * @param attributes Describe what the parameter does @todo-javadoc Write
  +      *      javadocs for method parameter
  +      * @return Describe the return value @todo-javadoc Write javadocs for return
  +      *      value
  +      * @exception XDocletException Describe the exception @todo-javadoc Write
  +      *      javadocs for exception
  +      */
  +     public String indexedConstructorParamValue(Properties attributes) throws 
XDocletException {
                String tagName = attributes.getProperty( "tagName" );
                String paramName = attributes.getProperty( "paramName" );
   
  -             if( tagName == null || paramName == null )
  +             if (tagName == null || paramName == null) {
                        throw new XDocletException( Translator.getString( 
"xdoclet.jmx.Messages", "missing_attribute" ) );
  +             }
                XTag[] tags = getCurrentMethod().doc().tags(tagName );
                String tagContent = tags[index].value();
                int begin = tagContent.indexOf( paramName + "=\"" ) + 
paramName.length() + 2;
  @@ -181,14 +253,21 @@
                return tagContent.substring( begin, end );
        }
   
  -     public String constructorSignature() throws XDocletException
  -     {
  +
  +     /**
  +      * Describe what the method does @todo-javadoc Write javadocs for method
  +      *
  +      * @return Describe the return value @todo-javadoc Write javadocs for return
  +      *      value
  +      * @exception XDocletException Describe the exception @todo-javadoc Write
  +      *      javadocs for exception
  +      */
  +     public String constructorSignature() throws XDocletException {
                XConstructor currentConstructor = getCurrentConstructor();
                String signature = currentConstructor.signature();
   
                // Remove spaces from the signature
  -             while( signature.indexOf( " " ) != -1 )
  -             {
  +             while (signature.indexOf(" ") != -1) {
                        int index = signature.indexOf( " " );
                        String before = signature.substring( 0, index );
                        String after = signature.substring( index + 1, 
signature.length() );
  @@ -199,6 +278,7 @@
                return "public " + currentConstructor.qualifiedName() + signature;
        }
   
  +
        /**
         * Implementation of {@link #mbeanName}.
         *
  @@ -206,20 +286,17 @@
         * @return                      Description of the Returned Value
         * @exception XDocletException  Description of Exception
         */
  -     protected String getMBeanName( XClass clazz ) throws XDocletException
  -     {
  +     protected String getMBeanName(XClass clazz) throws XDocletException {
                XTag bean_tag = clazz.doc().tag( "jmx:mbean" );
   
  -             if( bean_tag == null )
  -             {
  +             if (bean_tag == null) {
                        throw new XDocletException( Translator.getString( 
"class_tag_expected",
                                new String[]{"@jmx:mbean", clazz.qualifiedName()} ) );
                }
   
                String param_val = bean_tag.attributeValue( "name" );
   
  -             if( param_val == null )
  -             {
  +             if (param_val == null) {
                        throw new XDocletException( Translator.getString( 
"class_tag_parameter_expected",
                                new String[]{"name", "@jmx:mbean", 
clazz.qualifiedName()} ) );
                }
  @@ -227,28 +304,32 @@
                return param_val;
        }
   
  +
        /**
  -      * @todo (Aslak) this is very general stuff. It should be implemented higher 
up in the hierarchy
  -      * if it isn't already done somewhere
  +      * @todo (Aslak) this is very general stuff. It should be implemented higher up
  +      *      in the hierarchy if it isn't already done somewhere
  +      * @return The GetterMethod value
         */
  -     protected boolean isGetterMethod()
  -     {
  +     protected boolean isGetterMethod() {
                String methodName = getCurrentMethod().name();
                XClass retType = getCurrentMethod().returnType();
                XParameter[] params = getCurrentMethod().parameters();
   
  -             if( !retType.qualifiedName().equals( "void" ) && params.length == 0 )
  -                     if( methodName.startsWith( "get" ) || ( methodName.startsWith( 
"is" ) && retType.qualifiedName().equals( "boolean" ) ) )
  +             if (!retType.qualifiedName().equals("void") && params.length == 0) {
  +                     if (methodName.startsWith("get") || 
(methodName.startsWith("is") && retType.qualifiedName().equals("boolean"))) {
                                return true;
  +                     }
  +             }
                return false;
        }
   
  +
        /**
  -      * @todo (Aslak) this is very general stuff. It should be implemented higher 
up in the hierarchy
  -      * if it isn't already done somewhere
  +      * @todo (Aslak) this is very general stuff. It should be implemented higher up
  +      *      in the hierarchy if it isn't already done somewhere
  +      * @return The SetterMethod value
         */
  -     protected boolean isSetterMethod()
  -     {
  +     protected boolean isSetterMethod() {
                String methodName = getCurrentMethod().name();
                XClass retType = getCurrentMethod().returnType();
                XParameter[] params = getCurrentMethod().parameters();
  
  
  

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

Reply via email to