Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6287328

Add methods to StandardMBean to retrieve a method based on MBean{Attribute|Operation}Info

    XMLWordPrintable

Details

    • b43
    • generic
    • generic
    • Not verified

    Description

      It would be very useful if there were an easy way to work backwards from an MBeanAttributeInfo or MBeanOperationInfo to the Standard MBean method or methods that generated it. In particular this would make it easy to find annotations on the method and potentially modify the MBeanWhateverInfo based on them.

      This could look something like this, in javax.management.StandardMBean for example:

      public static Set<Method> findMethods(Class<?> mbeanInterface,
                                            MBeanAttributeInfo attr)
          throws NoSuchMethodException

      public static Method findMethod(Class<?> mbeanInterface,
                                      MBeanOperationInfo op)
          throws NoSuchMethodException

      In principle there should be at most one method corresponding to an MBeanOperationInfo. On the other hand, there can be more than one method corresponding to an MBeanAttributeInfo, since there can be both a getter and a setter. (In fact there could be a getter, setter, and "is" method, which would mean the mbeanInterface is illegal, but this case could be left unspecified.)

      These methods can be implemented quite easily just by iterating over mbeanInterface.getMethods() looking for methods that match. A more efficient solution (at least when the interface has many methods) would be to construct the expected method signature(s) and use mbeanInterface.getMethod to look for that directly.
      ###@###.### 2005-06-17 15:08:29 GMT

      Attachments

        Activity

          People

            jfdenise Jean-Francois Denise (Inactive)
            emcmanus Eamonn McManus
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: