User: ara_e_w 
  Date: 02/05/26 13:29:55

  Modified:    modules/jmx/src/xdoclet/modules/jmx Tag:
                        MODULE_REFACTORING_BRANCH JMXTagsHandler.java
  Log:
  xjavadoc javabeaninifiction refactoring
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +295 -314  
xdoclet/modules/jmx/src/xdoclet/modules/jmx/Attic/JMXTagsHandler.java
  
  Index: JMXTagsHandler.java
  ===================================================================
  RCS file: 
/cvsroot/xdoclet/xdoclet/modules/jmx/src/xdoclet/modules/jmx/Attic/JMXTagsHandler.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -w -r1.1.2.4 -r1.1.2.5
  --- JMXTagsHandler.java       29 Apr 2002 21:09:53 -0000      1.1.2.4
  +++ JMXTagsHandler.java       26 May 2002 20:29:55 -0000      1.1.2.5
  @@ -4,6 +4,13 @@
    */
   package xdoclet.modules.jmx;
   
  +import java.util.Collections;
  +import java.util.HashMap;
  +import java.util.Map;
  +import java.util.Properties;
  +
  +import org.apache.tools.ant.BuildException;
  +
   import xjavadoc.*;
   
   import xdoclet.XDocletException;
  @@ -12,23 +19,15 @@
   
   import xdoclet.util.Translator;
   
  -import java.util.Collections;
  -import java.util.HashMap;
  -import java.util.Map;
  -import java.util.Properties;
  -
  -import org.apache.tools.ant.BuildException;
  -
   /**
  - * @xdoclet:taghandler namespace="Jmx"
  - *
    * @author    Jerome Bernard ([EMAIL PROTECTED])
    * @author    Ara Abrahamian ([EMAIL PROTECTED])
    * @created   31 January 2002
  - * @version   $Revision: 1.1.2.4 $
  + * @xdoclet:taghandler   namespace="Jmx"
  + * @version              $Revision: 1.1.2.5 $
    * @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
   {
  @@ -48,14 +47,13 @@
        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.
  +     * 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
  @@ -69,13 +67,11 @@
         * @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() )
  -             {
  +        if (isGetterMethod()) {
                        generate( template );
                }
        }
  @@ -86,13 +82,11 @@
         * @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() )
  -             {
  +        if (isSetterMethod()) {
                        generate( template );
                }
        }
  @@ -117,18 +111,15 @@
                        false
                         );
   
  -             XMethod[] methods = getCurrentClass().methods();
  +        XMethod[] methods = getCurrentClass().getMethods();
   
  -             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].getName().equals("get" + name) || 
methods[i].getName().equals("is" + name)) {
                                hasGetterMethod = true;
                        }
                }
   
  -             if( ( isSetterMethod() && !hasGetterMethod ) || isGetterMethod() )
  -             {
  +        if ((isSetterMethod() && !hasGetterMethod) || isGetterMethod()) {
                        attributes.put( name, description );
                        generate( template );
                }
  @@ -147,12 +138,11 @@
         */
        public void forAllIndexedMethodParams( String template, Properties attributes 
) throws XDocletException
        {
  -             XTag[] tags = getCurrentMethod().doc().tags( 
"jmx:managed-operation-parameter" );
  +        XTag[] tags = 
getCurrentMethod().getDoc().getTags("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++;
                }
  @@ -171,12 +161,11 @@
         */
        public void forAllIndexedConstructorParams( String template, Properties 
attributes ) throws XDocletException
        {
  -             XTag[] tags = getCurrentConstructor().doc().tags( 
"jmx:managed-constructor-parameter" );
  +        XTag[] tags = 
getCurrentConstructor().getDoc().getTags("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++;
                }
  @@ -186,8 +175,7 @@
         * @param attributes            Describe what the parameter does
         * @return                      Describe the return value
         * @exception XDocletException  Describe the exception
  -      * @todo                        refactor common code with
  -      *      indexedConstructorParamValue into a private method
  +     * @todo                        refactor common code with 
indexedConstructorParamValue into a private method
         * @todo-javadoc                Write javadocs for method parameter
         * @todo-javadoc                Write javadocs for return value
         * @todo-javadoc                Write javadocs for exception
  @@ -197,13 +185,12 @@
                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.modules.jmx.Messages", "missing_attribute" ) );
                }
   
  -             XTag[] tags = getCurrentMethod().doc().tags( tagName );
  -             String tagContent = tags[index].value();
  +        XTag[] tags = getCurrentMethod().getDoc().getTags(tagName);
  +        String tagContent = tags[index].getValue();
                int begin = tagContent.indexOf( paramName + "=\"" ) + 
paramName.length() + 2;
                int end = tagContent.indexOf( "\"", begin );
   
  @@ -228,13 +215,12 @@
                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.modules.jmx.Messages", "missing_attribute" ) );
                }
   
  -             XTag[] tags = getCurrentConstructor().doc().tags( tagName );
  -             String tagContent = tags[index].value();
  +        XTag[] tags = getCurrentConstructor().getDoc().getTags(tagName);
  +        String tagContent = tags[index].getValue();
                int begin = tagContent.indexOf( paramName + "=\"" ) + 
paramName.length() + 2;
                int end = tagContent.indexOf( "\"", begin );
   
  @@ -253,11 +239,10 @@
        public String constructorSignature() throws XDocletException
        {
                XConstructor currentConstructor = getCurrentConstructor();
  -             String signature = currentConstructor.signature();
  +        String signature = currentConstructor.getSignature();
   
                // 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() );
  @@ -265,7 +250,7 @@
                        signature = before + after;
                }
                // Build the complete signature
  -             return "public " + currentConstructor.qualifiedName() + signature;
  +        return "public " + currentConstructor.getQualifiedName() + signature;
        }
   
        /**
  @@ -277,20 +262,18 @@
         */
        protected String getMBeanName( XClass clazz ) throws XDocletException
        {
  -             XTag bean_tag = clazz.doc().tag( "jmx:mbean" );
  +        XTag bean_tag = clazz.getDoc().getTag("jmx:mbean");
   
  -             if( bean_tag == null )
  -             {
  +        if (bean_tag == null) {
                        throw new XDocletException( Translator.getString( 
"class_tag_expected",
  -                             new String[]{"@jmx:mbean", clazz.qualifiedName()} ) );
  +                new String[]{"@jmx:mbean", clazz.getQualifiedName()}));
                }
   
  -             String param_val = bean_tag.attributeValue( "name" );
  +        String param_val = bean_tag.getAttributeValue("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()} ) );
  +                new String[]{"name", "@jmx:mbean", clazz.getQualifiedName()}));
                }
   
                return param_val;
  @@ -298,19 +281,17 @@
   
        /**
         * @return   The GetterMethod value
  -      * @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
         */
        protected boolean isGetterMethod()
        {
  -             String methodName = getCurrentMethod().name();
  -             XClass retType = getCurrentMethod().returnType();
  -             XParameter[] params = getCurrentMethod().parameters();
  +        String methodName = getCurrentMethod().getName();
  +        XClass retType = getCurrentMethod().getReturnType();
  +        XParameter[] params = getCurrentMethod().getParameters();
   
  -             if( !retType.qualifiedName().equals( "void" ) && params.length == 0 )
  -             {
  -                     if( methodName.startsWith( "get" ) || ( methodName.startsWith( 
"is" ) && retType.qualifiedName().equals( "boolean" ) ) )
  -                     {
  +        if (!retType.getQualifiedName().equals("void") && params.length == 0) {
  +            if (methodName.startsWith("get") || (methodName.startsWith("is") && 
retType.getQualifiedName().equals("boolean"))) {
                                return true;
                        }
                }
  @@ -319,16 +300,16 @@
   
        /**
         * @return   The SetterMethod value
  -      * @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
         */
        protected boolean isSetterMethod()
        {
  -             String methodName = getCurrentMethod().name();
  -             XClass retType = getCurrentMethod().returnType();
  -             XParameter[] params = getCurrentMethod().parameters();
  +        String methodName = getCurrentMethod().getName();
  +        XClass retType = getCurrentMethod().getReturnType();
  +        XParameter[] params = getCurrentMethod().getParameters();
   
  -             return ( retType.qualifiedName().equals( "void" ) && params.length == 
1 && methodName.startsWith( "set" ) );
  +        return (retType.getQualifiedName().equals("void") && params.length == 1 && 
methodName.startsWith("set"));
        }
   
   }
  
  
  

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

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

Reply via email to