You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by da...@apache.org on 2004/01/05 00:42:58 UTC

cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/jmx MBeanOperationSignature.java

dain        2004/01/04 15:42:58

  Modified:    modules/kernel/src/java/org/apache/geronimo/kernel/jmx
                        MBeanOperationSignature.java
  Log:
  Added helper method
  
  Revision  Changes    Path
  1.2       +23 -1     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/MBeanOperationSignature.java
  
  Index: MBeanOperationSignature.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/MBeanOperationSignature.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MBeanOperationSignature.java	7 Nov 2003 17:32:11 -0000	1.1
  +++ MBeanOperationSignature.java	4 Jan 2004 23:42:58 -0000	1.2
  @@ -56,6 +56,7 @@
   package org.apache.geronimo.kernel.jmx;
   
   import java.lang.reflect.Method;
  +import java.util.List;
   import javax.management.MBeanOperationInfo;
   import javax.management.MBeanParameterInfo;
   
  @@ -91,6 +92,27 @@
           this.name = name;
           if (argumentTypes != null) {
               this.argumentTypes = argumentTypes;
  +        } else {
  +            this.argumentTypes = NO_TYPES;
  +        }
  +    }
  +
  +    public MBeanOperationSignature(String name, List argumentTypes) {
  +        this.name = name;
  +        if (argumentTypes != null) {
  +            this.argumentTypes = new String[argumentTypes.size()];
  +            for (int i = 0; i < argumentTypes.size(); i++) {
  +                Object type = argumentTypes.get(i);
  +                if(type instanceof String) {
  +                    this.argumentTypes[i] = (String) type;
  +                } else if (type instanceof Class) {
  +                    this.argumentTypes[i] = ((Class)type).getName();
  +                } else {
  +                    throw new IllegalArgumentException("Parameter is not instance of String or Class:" +
  +                            " index=" + i +
  +                            " value=" + type);
  +                }
  +            }
           } else {
               this.argumentTypes = NO_TYPES;
           }