code: public static <T> T getMBean(Class<T> interfaceClass, ObjectName objectName) throws MBeanException {
  
          // Get the MBean server.
          MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
  
          validateMBean(interfaceClass, objectName, mBeanServer);
  
          // Create the MBean.
          return JMX.newMXBeanProxy(mBeanServer, objectName, interfaceClass);
      }
docs: Get the MBean represented by the interface class and object name.
  
  @param  interfaceClass  the MBean interface class.
  @param  objectName      the MBean object name.
  
  @return  the MBean.
  
  @throws  MBeanException  if unable to get the MBean.