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


Java ImmutableDescriptor.union方法代码示例

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


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

示例1: 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

示例2: 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

示例3: getClassMBeanInfo

import javax.management.ImmutableDescriptor; //导入方法依赖的package包/类
/**
 * Return the basic MBeanInfo for resources of the given class and
 * per-interface data.  This MBeanInfo might not be the final MBeanInfo
 * for instances of the class, because if the class is a
 * NotificationBroadcaster then each instance gets to decide what
 * MBeanNotificationInfo[] to put in its own MBeanInfo.
 */
final MBeanInfo getClassMBeanInfo(Class<?> resourceClass,
        PerInterface<M> perInterface) {
    MBeanInfoMap map = getMBeanInfoMap();
    synchronized (map) {
        WeakHashMap<Class<?>, MBeanInfo> intfMap = map.get(resourceClass);
        if (intfMap == null) {
            intfMap = new WeakHashMap<Class<?>, MBeanInfo>();
            map.put(resourceClass, intfMap);
        }
        Class<?> intfClass = perInterface.getMBeanInterface();
        MBeanInfo mbi = intfMap.get(intfClass);
        if (mbi == null) {
            MBeanInfo imbi = perInterface.getMBeanInfo();
            Descriptor descriptor =
                    ImmutableDescriptor.union(imbi.getDescriptor(),
                    getMBeanDescriptor(resourceClass));
            mbi = new MBeanInfo(resourceClass.getName(),
                    imbi.getDescription(),
                    imbi.getAttributes(),
                    findConstructors(resourceClass),
                    imbi.getOperations(),
                    (MBeanNotificationInfo[]) null,
                    descriptor);
            intfMap.put(intfClass, mbi);
        }
        return mbi;
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:36,代码来源:MBeanIntrospector.java

示例4: build

import javax.management.ImmutableDescriptor; //导入方法依赖的package包/类
public ReflectionMBeanAttribute build() {
  checkState(name != null);
  checkState(target != null);
  checkState(getter != null || setter != null);

  Descriptor getterDescriptor = null;
  if (getter != null) {
    getterDescriptor = DescriptorHelper.build(getter);
  }
  Descriptor setterDescriptor = null;
  if (setter != null) {
    setterDescriptor = DescriptorHelper.build(setter);
  }

  MBeanAttributeInfo info = new MBeanAttributeInfo(
      name,
      attributeType(getter, setter).getName(),
      description,
      getter != null, // readable
      setter != null, // writable
      isIs(getter),
      ImmutableDescriptor.union(getterDescriptor, setterDescriptor)
  );

  log.trace("Building attribute with info: {}", info);
  return new ReflectionMBeanAttribute(info, target, getter, setter);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:28,代码来源:ReflectionMBeanAttribute.java

示例5: OpenMBeanParameterInfoSupport

import javax.management.ImmutableDescriptor; //导入方法依赖的package包/类
/**
 * <p>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>
 *
 * <p>The {@code descriptor} can contain entries that will define
 * the values returned by certain methods of this class, as
 * explained in the {@link <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
 * {@link <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:openjdk,项目名称:jdk7-jdk,代码行数:60,代码来源:OpenMBeanParameterInfoSupport.java

示例6: OpenMBeanOperationInfoSupport

import javax.management.ImmutableDescriptor; //导入方法依赖的package包/类
/**
 * <p>Constructs an {@code OpenMBeanOperationInfoSupport}
 * instance, which describes the operation of a class of open
 * MBeans, with the specified {@code name}, {@code description},
 * {@code signature}, {@code returnOpenType}, {@code
 * impact}, and {@code descriptor}.</p>
 *
 * <p>The {@code signature} array parameter is internally copied,
 * so that subsequent changes to the array referenced by {@code
 * signature} have no effect on this instance.</p>
 *
 * @param name cannot be a null or empty string.
 *
 * @param description cannot be a null or empty string.
 *
 * @param signature can be null or empty if there are no
 * parameters to describe.
 *
 * @param returnOpenType cannot be null: use {@code
 * SimpleType.VOID} for operations that return nothing.
 *
 * @param impact must be one of {@code ACTION}, {@code
 * ACTION_INFO}, {@code INFO}, or {@code UNKNOWN}.
 *
 * @param descriptor The descriptor for the operation.  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
 * returnOpenType} is null, or {@code impact} is not one of {@code
 * ACTION}, {@code ACTION_INFO}, {@code INFO}, or {@code UNKNOWN}.
 *
 * @throws ArrayStoreException If {@code signature} is not an
 * array of instances of a subclass of {@code MBeanParameterInfo}.
 *
 * @since 1.6
 */
public OpenMBeanOperationInfoSupport(String name,
                                     String description,
                                     OpenMBeanParameterInfo[] signature,
                                     OpenType<?> returnOpenType,
                                     int impact,
                                     Descriptor descriptor) {
    super(name,
          description,
          arrayCopyCast(signature),
          // must prevent NPE here - we will throw IAE later on if
          // returnOpenType is null
          (returnOpenType == null) ? null : returnOpenType.getClassName(),
          impact,
          ImmutableDescriptor.union(descriptor,
            // must prevent NPE here - we will throw IAE later on if
            // returnOpenType is null
            (returnOpenType==null) ? null :returnOpenType.getDescriptor()));

    // check parameters that should not be null or empty
    // (unfortunately it is not done in superclass :-( ! )
    //
    if (name == null || name.trim().equals("")) {
        throw new IllegalArgumentException("Argument name cannot " +
                                           "be null or empty");
    }
    if (description == null || description.trim().equals("")) {
        throw new IllegalArgumentException("Argument description cannot " +
                                           "be null or empty");
    }
    if (returnOpenType == null) {
        throw new IllegalArgumentException("Argument returnOpenType " +
                                           "cannot be null");
    }

    if (impact != ACTION && impact != ACTION_INFO && impact != INFO &&
            impact != UNKNOWN) {
        throw new IllegalArgumentException("Argument impact can only be " +
                                           "one of ACTION, ACTION_INFO, " +
                                           "INFO, or UNKNOWN: " + impact);
    }

    this.returnOpenType = returnOpenType;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:81,代码来源:OpenMBeanOperationInfoSupport.java

示例7: OpenMBeanAttributeInfoSupport

import javax.management.ImmutableDescriptor; //导入方法依赖的package包/类
/**
 * <p>Constructs an {@code OpenMBeanAttributeInfoSupport} instance,
 * which describes the attribute of an open MBean with the
 * specified {@code name}, {@code openType}, {@code
 * description}, read/write access properties, and {@code Descriptor}.</p>
 *
 * <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 isReadable {@code true} if the attribute has a getter
 * exposed for management.
 *
 * @param isWritable {@code true} if the attribute has a setter
 * exposed for management.
 *
 * @param isIs {@code true} if the attribute's getter is of the
 * form <tt>is<i>XXX</i></tt>.
 *
 * @param descriptor The descriptor for the attribute.  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 OpenMBeanAttributeInfoSupport(String name,
                                     String description,
                                     OpenType<?> openType,
                                     boolean isReadable,
                                     boolean isWritable,
                                     boolean isIs,
                                     Descriptor descriptor) {
    // Construct parent's state
    //
    super(name,
          (openType==null) ? null : openType.getClassName(),
          description,
          isReadable,
          isWritable,
          isIs,
          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,代码行数:71,代码来源:OpenMBeanAttributeInfoSupport.java

示例8: OpenMBeanAttributeInfoSupport

import javax.management.ImmutableDescriptor; //导入方法依赖的package包/类
/**
 * <p>Constructs an {@code OpenMBeanAttributeInfoSupport} instance,
 * which describes the attribute of an open MBean with the
 * specified {@code name}, {@code openType}, {@code
 * description}, read/write access properties, and {@code Descriptor}.</p>
 *
 * <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 isReadable {@code true} if the attribute has a getter
 * exposed for management.
 *
 * @param isWritable {@code true} if the attribute has a setter
 * exposed for management.
 *
 * @param isIs {@code true} if the attribute's getter is of the
 * form <code>is<i>XXX</i></code>.
 *
 * @param descriptor The descriptor for the attribute.  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 OpenMBeanAttributeInfoSupport(String name,
                                     String description,
                                     OpenType<?> openType,
                                     boolean isReadable,
                                     boolean isWritable,
                                     boolean isIs,
                                     Descriptor descriptor) {
    // Construct parent's state
    //
    super(name,
          (openType==null) ? null : openType.getClassName(),
          description,
          isReadable,
          isWritable,
          isIs,
          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:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:71,代码来源:OpenMBeanAttributeInfoSupport.java

示例9: OpenMBeanAttributeInfoSupport

import javax.management.ImmutableDescriptor; //导入方法依赖的package包/类
/**
 * <p>Constructs an {@code OpenMBeanAttributeInfoSupport} instance,
 * which describes the attribute of an open MBean with the
 * specified {@code name}, {@code openType}, {@code
 * description}, read/write access properties, and {@code Descriptor}.</p>
 *
 * <p>The {@code descriptor} can contain entries that will define
 * the values returned by certain methods of this class, as
 * explained in the {@link <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 isReadable {@code true} if the attribute has a getter
 * exposed for management.
 *
 * @param isWritable {@code true} if the attribute has a setter
 * exposed for management.
 *
 * @param isIs {@code true} if the attribute's getter is of the
 * form <tt>is<i>XXX</i></tt>.
 *
 * @param descriptor The descriptor for the attribute.  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
 * {@link <a href="package-summary.html#constraints">package
 * description</a>}.
 *
 * @since 1.6
 */
public OpenMBeanAttributeInfoSupport(String name,
                                     String description,
                                     OpenType<?> openType,
                                     boolean isReadable,
                                     boolean isWritable,
                                     boolean isIs,
                                     Descriptor descriptor) {
    // Construct parent's state
    //
    super(name,
          (openType==null) ? null : openType.getClassName(),
          description,
          isReadable,
          isWritable,
          isIs,
          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:aducode,项目名称:openjdk-source-code-learn,代码行数:72,代码来源:OpenMBeanAttributeInfoSupport.java


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