当前位置: 首页>>代码示例>>Java>>正文


Java ImmutableDescriptor类代码示例

本文整理汇总了Java中javax.management.ImmutableDescriptor的典型用法代码示例。如果您正苦于以下问题:Java ImmutableDescriptor类的具体用法?Java ImmutableDescriptor怎么用?Java ImmutableDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ImmutableDescriptor类属于javax.management包,在下文中一共展示了ImmutableDescriptor类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makeDescriptor

import javax.management.ImmutableDescriptor; //导入依赖的package包/类
static <T> Descriptor makeDescriptor(OpenType<T> openType,
                                     T defaultValue,
                                     T[] legalValues,
                                     Comparable<T> minValue,
                                     Comparable<T> maxValue) {
    Map<String, Object> map = new HashMap<String, Object>();
    if (defaultValue != null)
        map.put("defaultValue", defaultValue);
    if (legalValues != null) {
        Set<T> set = new HashSet<T>();
        for (T v : legalValues)
            set.add(v);
        set = Collections.unmodifiableSet(set);
        map.put("legalValues", set);
    }
    if (minValue != null)
        map.put("minValue", minValue);
    if (maxValue != null)
        map.put("maxValue", maxValue);
    if (map.isEmpty()) {
        return openType.getDescriptor();
    } else {
        map.put("openType", openType);
        return new ImmutableDescriptor(map);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:OpenMBeanAttributeInfoSupport.java

示例2: check

import javax.management.ImmutableDescriptor; //导入依赖的package包/类
private static void check(Object x, Descriptor d, Descriptor expect) {
    String fail = null;
    try {
        Descriptor u = ImmutableDescriptor.union(d, expect);
        if (!u.equals(d))
            fail = "should contain " + expect + "; is " + d;
    } catch (IllegalArgumentException e) {
        fail = e.getMessage();
    }
    if (fail == null) {
        System.out.println("OK: " + x);
    } else {
        failed = "NOT OK: Incorrect descriptor for: " + x;
        System.out.println(failed);
        System.out.println("..." + fail);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:AnnotationTest.java

示例3: getBasicMBeanDescriptor

import javax.management.ImmutableDescriptor; //导入依赖的package包/类
@Override
Descriptor getBasicMBeanDescriptor() {
    /* We don't bother saying mxbean=false, and we can't know whether
       the info is immutable until we know whether the MBean class
       (not interface) is a NotificationBroadcaster. */
    return ImmutableDescriptor.EMPTY_DESCRIPTOR;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:StandardMBeanIntrospector.java

示例4: getMBeanDescriptor

import javax.management.ImmutableDescriptor; //导入依赖的package包/类
@Override
Descriptor getMBeanDescriptor(Class<?> resourceClass) {
    /* We already have immutableInfo=true in the Descriptor
     * included in the MBeanInfo for the MXBean interface.  This
     * method is being called for the MXBean *class* to add any
     * new items beyond those in the interface Descriptor, which
     * currently it does not.
     */
    return ImmutableDescriptor.EMPTY_DESCRIPTOR;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:MXBeanIntrospector.java

示例5: typeDescriptor

import javax.management.ImmutableDescriptor; //导入依赖的package包/类
private static Descriptor typeDescriptor(OpenType<?> openType,
                                         Type originalType) {
    return new ImmutableDescriptor(
        new String[] {"openType",
                      "originalType"},
        new Object[] {openType,
                      originalTypeString(originalType)});
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:MXBeanIntrospector.java

示例6: makeMBeanInfo

import javax.management.ImmutableDescriptor; //导入依赖的package包/类
/** Make an MBeanInfo based on the attributes and operations
 *  found in the interface. */
MBeanInfo makeMBeanInfo(Class<?> mbeanInterface,
        String description) {
    final MBeanAttributeInfo[] attrArray =
            attrs.toArray(new MBeanAttributeInfo[0]);
    final MBeanOperationInfo[] opArray =
            ops.toArray(new MBeanOperationInfo[0]);
    final String interfaceClassName =
            "interfaceClassName=" + mbeanInterface.getName();
    final Descriptor classNameDescriptor =
            new ImmutableDescriptor(interfaceClassName);
    final Descriptor mbeanDescriptor = getBasicMBeanDescriptor();
    final Descriptor annotatedDescriptor =
            Introspector.descriptorForElement(mbeanInterface);
    final Descriptor descriptor =
        DescriptorCache.getInstance().union(
            classNameDescriptor,
            mbeanDescriptor,
            annotatedDescriptor);

    return new MBeanInfo(mbeanInterface.getName(),
            description,
            attrArray,
            null,
            opArray,
            null,
            descriptor);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:MBeanIntrospector.java

示例7: get

import javax.management.ImmutableDescriptor; //导入依赖的package包/类
public ImmutableDescriptor get(ImmutableDescriptor descriptor) {
    WeakReference<ImmutableDescriptor> wr = map.get(descriptor);
    ImmutableDescriptor got = (wr == null) ? null : wr.get();
    if (got != null)
        return got;
    map.put(descriptor, new WeakReference<ImmutableDescriptor>(descriptor));
    return descriptor;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:DescriptorCache.java

示例8: OpenMBeanParameterInfoSupport

import javax.management.ImmutableDescriptor; //导入依赖的package包/类
/**
 * Constructs an {@code OpenMBeanParameterInfoSupport} instance,
 * which describes the parameter used in one or more operations or
 * constructors of a class of open MBeans, with the specified
 * {@code name}, {@code openType}, {@code description},
 * and {@code descriptor}.
 *
 * <p>The {@code descriptor} can contain entries that will define
 * the values returned by certain methods of this class, as
 * explained in the <a href="package-summary.html#constraints">
 * package description</a>.
 *
 * @param name  cannot be a null or empty string.
 *
 * @param description  cannot be a null or empty string.
 *
 * @param openType  cannot be null.
 *
 * @param descriptor The descriptor for the parameter.  This may be null
 * which is equivalent to an empty descriptor.
 *
 * @throws IllegalArgumentException if {@code name} or {@code
 * description} are null or empty string, or {@code openType} is
 * null, or the descriptor entries are invalid as described in the
 * <a href="package-summary.html#constraints">package
 * description</a>.
 *
 * @since 1.6
 */
public OpenMBeanParameterInfoSupport(String name,
                                     String description,
                                     OpenType<?> openType,
                                     Descriptor descriptor) {


    // Construct parent's state
    //
    super(name,
          (openType==null) ? null : openType.getClassName(),
          description,
          ImmutableDescriptor.union(descriptor,(openType==null)?null:
            openType.getDescriptor()));

    // Initialize this instance's specific state
    //
    this.openType = openType;

    descriptor = getDescriptor();  // replace null by empty
    this.defaultValue = valueFrom(descriptor, "defaultValue", openType);
    this.legalValues = valuesFrom(descriptor, "legalValues", openType);
    this.minValue = comparableValueFrom(descriptor, "minValue", openType);
    this.maxValue = comparableValueFrom(descriptor, "maxValue", openType);

    try {
        check(this);
    } catch (OpenDataException e) {
        throw new IllegalArgumentException(e.getMessage(), e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:60,代码来源:OpenMBeanParameterInfoSupport.java

示例9: initNotifDescriptorAtt

import javax.management.ImmutableDescriptor; //导入依赖的package包/类
private void initNotifDescriptorAtt() {
    String key = "CRABE";
    String value = "TAMBOUR";
    notifDescriptorAtt =
            new ImmutableDescriptor(new String[]{key + "=" + value});
    notifDescriptorAsMapAtt =
            new HashMap<String, String>();
    notifDescriptorAsMapAtt.put(key, value);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:Basic.java


注:本文中的javax.management.ImmutableDescriptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。