commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules MbeansDescriptorsIntrospectionSource.java
Date Tue, 22 Jul 2003 18:11:19 GMT
dims        2003/07/22 11:11:19

  Modified:    modeler/src/java/org/apache/commons/modeler/modules
                        MbeansDescriptorsIntrospectionSource.java
  Log:
  - Introspection now adds constructor information.
  
  Revision  Changes    Path
  1.11      +22 -0     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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- MbeansDescriptorsIntrospectionSource.java	22 Jul 2003 16:03:19 -0000	1.10
  +++ MbeansDescriptorsIntrospectionSource.java	22 Jul 2003 18:11:19 -0000	1.11
  @@ -7,10 +7,12 @@
   import org.apache.commons.modeler.OperationInfo;
   import org.apache.commons.modeler.ParameterInfo;
   import org.apache.commons.modeler.Registry;
  +import org.apache.commons.modeler.ConstructorInfo;
   
   import javax.management.ObjectName;
   import java.lang.reflect.Method;
   import java.lang.reflect.Modifier;
  +import java.lang.reflect.Constructor;
   import java.math.BigDecimal;
   import java.math.BigInteger;
   import java.util.ArrayList;
  @@ -327,6 +329,26 @@
                   }
               }
   
  +            Constructor[] constructors = realClass.getConstructors();
  +            for(int i=0;i<constructors.length;i++) {
  +                ConstructorInfo info = new ConstructorInfo();
  +                String className = realClass.getName();
  +                int nIndex = -1;
  +                if((nIndex = className.lastIndexOf('.'))!=-1) {
  +                    className = className.substring(nIndex+1);
  +                }
  +                info.setName(className);
  +                info.setDescription(constructors[i].getName());
  +                Class classes[] = constructors[i].getParameterTypes();
  +                for(int j=0;j<classes.length;j++) {
  +                    ParameterInfo pi = new ParameterInfo();
  +                    pi.setType(classes[j].getName());
  +                    pi.setName("param" + j);
  +                    info.addParameter(pi);
  +                }
  +                mbean.addConstructor(info);
  +            }
  +            
               if( log.isDebugEnabled())
                   log.debug("Setting name: " + type );
               mbean.setName( type );
  
  
  

---------------------------------------------------------------------
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