commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules MbeansDescriptorsIntrospectionSource.java
Date Mon, 03 Feb 2003 21:43:57 GMT
costin      2003/02/03 13:43:57

  Modified:    modeler/src/java/org/apache/commons/modeler/modules
                        MbeansDescriptorsIntrospectionSource.java
  Log:
  Set the readable/writtable flag.
  
  Support isXXX methods.
  
  Revision  Changes    Path
  1.5       +29 -2     jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/MbeansDescriptorsIntrospectionSource.java
  
  Index: MbeansDescriptorsIntrospectionSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/MbeansDescriptorsIntrospectionSource.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MbeansDescriptorsIntrospectionSource.java	24 Jan 2003 22:38:44 -0000	1.4
  +++ MbeansDescriptorsIntrospectionSource.java	3 Feb 2003 21:43:57 -0000	1.5
  @@ -123,7 +123,7 @@
                   Class ret=methods[j].getReturnType();
                   if( ! supportedType( ret ) ) {
                       if( log.isDebugEnabled() )
  -                        log.debug("Unsupported type " + methods[j] + " " + ret );
  +                        log.debug("Unsupported type " + methods[j]);
                       continue;
                   }
                   name=unCapitalize( name.substring(3));
  @@ -133,6 +133,28 @@
                   attMap.put( name, methods[j] );
               } else if( name.startsWith( "is" ) ) {
                   // not used in our code. Add later
  +                Class params[]=methods[j].getParameterTypes();
  +                if( params.length != 0 ) {
  +                    if( log.isDebugEnabled())
  +                        log.debug("Wrong param count " + name + " " + params.length);
  +                    continue;
  +                }
  +                if( ! Modifier.isPublic( methods[j].getModifiers() ) ) {
  +                    if( log.isDebugEnabled())
  +                        log.debug("Not public " + methods[j] );
  +                    continue;
  +                }
  +                Class ret=methods[j].getReturnType();
  +                if( Boolean.TYPE != ret  ) {
  +                    if( log.isDebugEnabled() )
  +                        log.debug("Unsupported type " + methods[j] + " " + ret );
  +                    continue;
  +                }
  +                name=unCapitalize( name.substring(2));
  +
  +                getAttMap.put( name, methods[j] );
  +                // just a marker, we don't use the value
  +                attMap.put( name, methods[j] );
   
               } else if( name.startsWith( "set" ) ) {
                   Class params[]=methods[j].getParameterTypes();
  @@ -222,7 +244,12 @@
                   ai.setDescription("Introspected attribute " + name);
                   if( log.isDebugEnabled()) log.debug("Introspected attribute " +
                           name + " " + gm + " " + sm);
  -                mbean.addAttribute(ai);
  +                if( gm==null )
  +                    ai.setReadable(false);
  +                if( sm==null )
  +                    ai.setWriteable(false);
  +                if( sm!=null || gm!=null )
  +                    mbean.addAttribute(ai);
               }
   
               en=invokeAttMap.keys();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message