Java 类javax.management.ImmutableDescriptor 实例源码

项目:OpenJSharp    文件:OpenMBeanAttributeInfoSupport.java   
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);
    }
}
项目:jdk8u-jdk    文件:OpenMBeanAttributeInfoSupport.java   
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);
    }
}
项目:jdk8u-jdk    文件:AnnotationTest.java   
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);
    }
}
项目:openjdk-jdk10    文件:OpenMBeanAttributeInfoSupport.java   
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);
    }
}
项目:openjdk-jdk10    文件:AnnotationTest.java   
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);
    }
}
项目:openjdk9    文件:OpenMBeanAttributeInfoSupport.java   
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);
    }
}
项目:openjdk9    文件:AnnotationTest.java   
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);
    }
}
项目:Java8CN    文件:OpenMBeanAttributeInfoSupport.java   
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);
    }
}
项目:jdk8u_jdk    文件:OpenMBeanAttributeInfoSupport.java   
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);
    }
}
项目:jdk8u_jdk    文件:AnnotationTest.java   
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);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:OpenMBeanAttributeInfoSupport.java   
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);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:AnnotationTest.java   
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);
    }
}
项目:infobip-open-jdk-8    文件:OpenMBeanAttributeInfoSupport.java   
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);
    }
}
项目:infobip-open-jdk-8    文件:AnnotationTest.java   
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);
    }
}
项目:jdk8u-dev-jdk    文件:OpenMBeanAttributeInfoSupport.java   
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);
    }
}
项目:jdk8u-dev-jdk    文件:AnnotationTest.java   
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);
    }
}
项目:jdk7-jdk    文件:OpenMBeanAttributeInfoSupport.java   
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);
    }
}
项目:jdk7-jdk    文件:AnnotationTest.java   
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);
    }
}
项目:openjdk-source-code-learn    文件:OpenMBeanAttributeInfoSupport.java   
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);
    }
}
项目:openjdk-source-code-learn    文件:AnnotationTest.java   
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);
    }
}
项目:OLD-OpenJDK8    文件:OpenMBeanAttributeInfoSupport.java   
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);
    }
}
项目:OLD-OpenJDK8    文件:AnnotationTest.java   
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);
    }
}
项目:JAVA_UNIT    文件:AnnotationTest.java   
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);
    }
}
项目:openjdk-jdk7u-jdk    文件:OpenMBeanAttributeInfoSupport.java   
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);
    }
}
项目:openjdk-jdk7u-jdk    文件:AnnotationTest.java   
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);
    }
}
项目:openjdk-icedtea7    文件:OpenMBeanAttributeInfoSupport.java   
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);
    }
}
项目:openjdk-icedtea7    文件:AnnotationTest.java   
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);
    }
}
项目:OpenJSharp    文件:StandardMBeanIntrospector.java   
@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;
}
项目:OpenJSharp    文件:MXBeanIntrospector.java   
@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;
}
项目:OpenJSharp    文件:MXBeanIntrospector.java   
private static Descriptor typeDescriptor(OpenType<?> openType,
                                         Type originalType) {
    return new ImmutableDescriptor(
        new String[] {"openType",
                      "originalType"},
        new Object[] {openType,
                      originalTypeString(originalType)});
}
项目:OpenJSharp    文件:MBeanIntrospector.java   
/** 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);
}
项目:OpenJSharp    文件:DescriptorCache.java   
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;
}
项目:OpenJSharp    文件:OpenMBeanParameterInfoSupport.java   
/**
 * 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);
    }
}
项目:jdk8u-jdk    文件:StandardMBeanIntrospector.java   
@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;
}
项目:jdk8u-jdk    文件:MXBeanIntrospector.java   
@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;
}
项目:jdk8u-jdk    文件:MXBeanIntrospector.java   
private static Descriptor typeDescriptor(OpenType<?> openType,
                                         Type originalType) {
    return new ImmutableDescriptor(
        new String[] {"openType",
                      "originalType"},
        new Object[] {openType,
                      originalTypeString(originalType)});
}
项目:jdk8u-jdk    文件:MBeanIntrospector.java   
/** 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);
}
项目:jdk8u-jdk    文件:DescriptorCache.java   
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;
}
项目:jdk8u-jdk    文件:OpenMBeanParameterInfoSupport.java   
/**
 * 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);
    }
}
项目:jdk8u-jdk    文件:Basic.java   
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);
}