/** * Determine whether the given bean class qualifies as an MBean as-is. * <p>This implementation checks for {@link javax.management.DynamicMBean} * classes as well as classes with corresponding "*MBean" interface * (Standard MBeans) or corresponding "*MXBean" interface (Java 6 MXBeans). * @param clazz the bean class to analyze * @return whether the class qualifies as an MBean * @see org.springframework.jmx.export.MBeanExporter#isMBean(Class) */ public static boolean isMBean(@Nullable Class<?> clazz) { return (clazz != null && (DynamicMBean.class.isAssignableFrom(clazz) || (getMBeanInterface(clazz) != null || getMXBeanInterface(clazz) != null))); }
/** * Return the Java 6 MXBean interface exists for the given class, if any * (that is, an interface whose name ends with "MXBean" and/or * carries an appropriate MXBean annotation). * @param clazz the class to check * @return whether there is an MXBean interface for the given class */ @Nullable public static Class<?> getMXBeanInterface(@Nullable Class<?> clazz) { if (clazz == null || clazz.getSuperclass() == null) { return null; } Class<?>[] implementedInterfaces = clazz.getInterfaces(); for (Class<?> iface : implementedInterfaces) { if (JMX.isMXBeanInterface(iface)) { return iface; } } return getMXBeanInterface(clazz.getSuperclass()); }
/** * Determine whether the given bean class qualifies as an MBean as-is. * <p>This implementation checks for {@link javax.management.DynamicMBean} * classes as well as classes with corresponding "*MBean" interface * (Standard MBeans) or corresponding "*MXBean" interface (Java 6 MXBeans). * @param clazz the bean class to analyze * @return whether the class qualifies as an MBean * @see org.springframework.jmx.export.MBeanExporter#isMBean(Class) */ public static boolean isMBean(@Nullable Class<?> clazz) { return (clazz != null && (DynamicMBean.class.isAssignableFrom(clazz) || (getMBeanInterface(clazz) != null || getMXBeanInterface(clazz) != null))); }
/** * Return the Java 6 MXBean interface exists for the given class, if any * (that is, an interface whose name ends with "MXBean" and/or * carries an appropriate MXBean annotation). * @param clazz the class to check * @return whether there is an MXBean interface for the given class */ @Nullable public static Class<?> getMXBeanInterface(@Nullable Class<?> clazz) { if (clazz == null || clazz.getSuperclass() == null) { return null; } Class<?>[] implementedInterfaces = clazz.getInterfaces(); for (Class<?> iface : implementedInterfaces) { if (JMX.isMXBeanInterface(iface)) { return iface; } } return getMXBeanInterface(clazz.getSuperclass()); }
Class<?> targetClass = AopUtils.getTargetClass(bean); if (targetClass != bean.getClass()) { Class<?> ifc = JmxUtils.getMXBeanInterface(targetClass); if (ifc != null) { if (!ifc.isInstance(bean)) {
Class<?> targetClass = AopUtils.getTargetClass(bean); if (targetClass != bean.getClass()) { Class<?> ifc = JmxUtils.getMXBeanInterface(targetClass); if (ifc != null) { if (!ifc.isInstance(bean)) {
/** * Determine whether the given bean class qualifies as an MBean as-is. * <p>This implementation checks for {@link javax.management.DynamicMBean} * classes as well as classes with corresponding "*MBean" interface * (Standard MBeans) or corresponding "*MXBean" interface (Java 6 MXBeans). * @param clazz the bean class to analyze * @return whether the class qualifies as an MBean * @see org.springframework.jmx.export.MBeanExporter#isMBean(Class) */ public static boolean isMBean(@Nullable Class<?> clazz) { return (clazz != null && (DynamicMBean.class.isAssignableFrom(clazz) || (getMBeanInterface(clazz) != null || getMXBeanInterface(clazz) != null))); }
/** * Return the Java 6 MXBean interface exists for the given class, if any * (that is, an interface whose name ends with "MXBean" and/or * carries an appropriate MXBean annotation). * @param clazz the class to check * @return whether there is an MXBean interface for the given class */ @Nullable public static Class<?> getMXBeanInterface(@Nullable Class<?> clazz) { if (clazz == null || clazz.getSuperclass() == null) { return null; } Class<?>[] implementedInterfaces = clazz.getInterfaces(); for (Class<?> iface : implementedInterfaces) { if (JMX.isMXBeanInterface(iface)) { return iface; } } return getMXBeanInterface(clazz.getSuperclass()); }
Class<?> targetClass = AopUtils.getTargetClass(bean); if (targetClass != bean.getClass()) { Class<?> ifc = JmxUtils.getMXBeanInterface(targetClass); if (ifc != null) { if (!ifc.isInstance(bean)) {