本文整理汇总了Java中com.sun.jmx.mbeanserver.Introspector.ALLOW_NONPUBLIC_MBEAN属性的典型用法代码示例。如果您正苦于以下问题:Java Introspector.ALLOW_NONPUBLIC_MBEAN属性的具体用法?Java Introspector.ALLOW_NONPUBLIC_MBEAN怎么用?Java Introspector.ALLOW_NONPUBLIC_MBEAN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.jmx.mbeanserver.Introspector
的用法示例。
在下文中一共展示了Introspector.ALLOW_NONPUBLIC_MBEAN属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isMXBeanInterface
/**
* <p>Test whether an interface is an MXBean interface.
* An interface is an MXBean interface if it is public,
* annotated {@link MXBean @MXBean} or {@code @MXBean(true)}
* or if it does not have an {@code @MXBean} annotation
* and its name ends with "{@code MXBean}".</p>
*
* @param interfaceClass The candidate interface.
*
* @return true if {@code interfaceClass} is a
* {@link javax.management.MXBean compliant MXBean interface}
*
* @throws NullPointerException if {@code interfaceClass} is null.
*/
public static boolean isMXBeanInterface(Class<?> interfaceClass) {
if (!interfaceClass.isInterface())
return false;
if (!Modifier.isPublic(interfaceClass.getModifiers()) &&
!Introspector.ALLOW_NONPUBLIC_MBEAN) {
return false;
}
MXBean a = interfaceClass.getAnnotation(MXBean.class);
if (a != null)
return a.value();
return interfaceClass.getName().endsWith("MXBean");
// We don't bother excluding the case where the name is
// exactly the string "MXBean" since that would mean there
// was no package name, which is pretty unlikely in practice.
}