/** * create a typed object from an mbean */ public static final Object typeMBean(MBeanServer server, ObjectName mbean, Class mainInterface) throws Exception { List interfaces = new ArrayList(); if (mainInterface.isInterface()) { interfaces.add(mainInterface); } addInterfaces(mainInterface.getInterfaces(), interfaces); Class cl[] = (Class[]) interfaces.toArray(new Class[interfaces.size()]); if (DEBUG) { System.err.println("typeMean->server=" + server + ",mbean=" + mbean + ",mainInterface=" + mainInterface); for (int c = 0; c < cl.length; c++) { System.err.println(" :" + cl[c]); } } return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), cl, new MBeanTyperInvoker(server, mbean)); }
else if (isJMXAttribute(method) && (args == null || args.length <= 0))
else if (isJMXAttribute(method) && (args == null || args.length <= 0))
/** * create a typed object from an mbean * @param server * @param mbean * @param mainInterface * @return the object * @throws Exception */ public static final Object typeMBean(MBeanServer server, ObjectName mbean, Class mainInterface) throws Exception { List interfaces = new ArrayList(); if (mainInterface.isInterface()) { interfaces.add(mainInterface); } addInterfaces(mainInterface.getInterfaces(), interfaces); Class cl[] = (Class[]) interfaces.toArray(new Class[interfaces.size()]); if (DEBUG) { System.err.println("typeMean->server=" + server + ",mbean=" + mbean + ",mainInterface=" + mainInterface); for (int c = 0; c < cl.length; c++) { System.err.println(" :" + cl[c]); } } return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), cl, new MBeanTyperInvoker(server, mbean)); }