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


Java ArrayType类代码示例

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


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

示例1: CollectionMapping

import javax.management.openmbean.ArrayType; //导入依赖的package包/类
CollectionMapping(Type targetType,
                  ArrayType<?> openArrayType,
                  Class<?> openArrayClass,
                  MXBeanMapping elementMapping) {
    super(targetType, openArrayType);
    this.elementMapping = elementMapping;

    /* Determine the concrete class to be used when converting
       back to this Java type.  We convert all Lists to ArrayList
       and all Sets to TreeSet.  (TreeSet because it is a SortedSet,
       so works for both Set and SortedSet.)  */
    Type raw = ((ParameterizedType) targetType).getRawType();
    Class<?> c = (Class<?>) raw;
    final Class<?> collC;
    if (c == List.class)
        collC = ArrayList.class;
    else if (c == Set.class)
        collC = HashSet.class;
    else if (c == SortedSet.class)
        collC = TreeSet.class;
    else { // can't happen
        assert(false);
        collC = null;
    }
    collectionClass = Util.cast(collC);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:DefaultMXBeanMappingFactory.java

示例2: CollectionConverter

import javax.management.openmbean.ArrayType; //导入依赖的package包/类
CollectionConverter(Type targetType, ArrayType openArrayType, Class openArrayClass,
    OpenTypeConverter elementConverter) {
  super(targetType, openArrayType, openArrayClass);
  this.elementConverter = elementConverter;

  /*
   * Determine the concrete class to be used when converting back to this Java type. We convert
   * all Lists to ArrayList and all Sets to TreeSet. (TreeSet because it is a SortedSet, so works
   * for both Set and SortedSet.)
   */
  Type raw = ((ParameterizedType) targetType).getRawType();
  Class c = (Class<?>) raw;
  if (c == List.class)
    collectionClass = ArrayList.class;
  else if (c == Set.class)
    collectionClass = HashSet.class;
  else if (c == SortedSet.class)
    collectionClass = TreeSet.class;
  else { // can't happen
    assert (false);
    collectionClass = null;
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:24,代码来源:CollectionConverter.java

示例3: isTypeMatched

import javax.management.openmbean.ArrayType; //导入依赖的package包/类
private static boolean isTypeMatched(OpenType<?> ot1, OpenType<?> ot2) {
    if (ot1 instanceof CompositeType) {
        if (! (ot2 instanceof CompositeType))
            return false;
        if (!isTypeMatched((CompositeType) ot1, (CompositeType) ot2))
            return false;
    } else if (ot1 instanceof TabularType) {
        if (! (ot2 instanceof TabularType))
            return false;
        if (!isTypeMatched((TabularType) ot1, (TabularType) ot2))
            return false;
    } else if (ot1 instanceof ArrayType) {
        if (! (ot2 instanceof ArrayType))
            return false;
        if (!isTypeMatched((ArrayType<?>) ot1, (ArrayType<?>) ot2)) {
            return false;
        }
    } else if (!ot1.equals(ot2)) {
        return false;
    }
    return true;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:LazyCompositeData.java

示例4: getVersionedArrayType

import javax.management.openmbean.ArrayType; //导入依赖的package包/类
private ArrayType<?> getVersionedArrayType(ArrayType<?> type, String version)
    throws OpenDataException
{
    if (type.isPrimitiveArray()) {
        return type;
    }
    OpenType<?> ot = getVersionedType(
        type.getElementOpenType(),
        version
    );
    if (ot instanceof SimpleType) {
        return new ArrayType<>((SimpleType<?>)ot, type.isPrimitiveArray());
    } else {
        return new ArrayType<>(type.getDimension(), ot);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:TypeVersionMapper.java

示例5: before

import javax.management.openmbean.ArrayType; //导入依赖的package包/类
@Before
public void before() throws OpenDataException {
	exceptionDetailsItemNames = new String[]{
			"lastException",
			"lastExceptionCausedObject",
			"lastExceptionStackTrace",
			"lastExceptionTimestamp",
			"totalExceptions"
	};

	exceptionDetailsItemTypes = new OpenType<?>[]{
			SimpleType.STRING,
			SimpleType.STRING,
			new ArrayType<>(1, SimpleType.STRING),
			SimpleType.LONG,
			SimpleType.INTEGER
	};
}
 
开发者ID:softindex,项目名称:datakernel,代码行数:19,代码来源:ExceptionStatsTest.java

示例6: getOpenType

import javax.management.openmbean.ArrayType; //导入依赖的package包/类
private static OpenType getOpenType(Object value) throws OpenDataException {
    if (value == null) {
        return SimpleType.VOID;
    }

    //if (OpenType.ALLOWED_CLASSNAMES_LIST.contains(name)) {
    int dim = 0;
    Class<?> cls = value.getClass();
    while (cls.isArray()) {
    	cls = value.getClass().getComponentType();
    	dim++;
    }
	SimpleType<?> type = getTypeForName(cls.getName());
	if (type != null && dim > 0) {
		if (cls.isPrimitive() && dim == 1) {
    		return new ArrayType<>(type, true);
		}
		return new ArrayType<>(dim, type);
	}
   	return type;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:22,代码来源:JMXUtils.java

示例7: test_from_scenario2

import javax.management.openmbean.ArrayType; //导入依赖的package包/类
public void test_from_scenario2() throws Exception {
    initialValues[0] = "1";
    ArrayType stackTraceArray = new ArrayType(1, stackTraceElementType);
    OpenType[] types = { SimpleType.STRING, SimpleType.STRING,
            SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
            SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
            SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
            SimpleType.STRING, stackTraceArray, SimpleType.STRING };
    CompositeType compositeType = getCompositeType(initialNames, types);
    CompositeData data = new CompositeDataSupport(compositeType,
            initialNames, initialValues);
    try {
        ThreadInfo.from(data);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // Expected
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:ThreadInfoTest.java

示例8: test_from_scenario4

import javax.management.openmbean.ArrayType; //导入依赖的package包/类
public void test_from_scenario4() throws Exception {
    initialValues[0] = null;
    ArrayType stackTraceArray = new ArrayType(1, stackTraceElementType);
    OpenType[] types = { SimpleType.LONG, SimpleType.STRING,
            SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
            SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
            SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
            SimpleType.STRING, stackTraceArray, SimpleType.STRING };
    CompositeType compositeType = getCompositeType(initialNames, types);
    CompositeData data = new CompositeDataSupport(compositeType,
            initialNames, initialValues);
    try {
        ThreadInfo.from(data);
        fail("should throw NullPointerException");
    } catch (NullPointerException e) {
        // Expected
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:ThreadInfoTest.java

示例9: test_from_scenario5

import javax.management.openmbean.ArrayType; //导入依赖的package包/类
public void test_from_scenario5() throws Exception {
    initialValues[1] = null;
    ArrayType stackTraceArray = new ArrayType(1, stackTraceElementType);
    OpenType[] types = { SimpleType.LONG, SimpleType.STRING,
            SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
            SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
            SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
            SimpleType.STRING, stackTraceArray, SimpleType.STRING };
    CompositeType compositeType = getCompositeType(initialNames, types);
    CompositeData data = new CompositeDataSupport(compositeType,
            initialNames, initialValues);
    try {
        ThreadInfo.from(data);
        fail("should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // Expected
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:ThreadInfoTest.java

示例10: test_from_scenario6

import javax.management.openmbean.ArrayType; //导入依赖的package包/类
public void test_from_scenario6() throws Exception {
    initialValues[2] = null;
    ArrayType stackTraceArray = new ArrayType(1, stackTraceElementType);
    OpenType[] types = { SimpleType.LONG, SimpleType.STRING,
            SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
            SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
            SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
            SimpleType.STRING, stackTraceArray, SimpleType.STRING };
    CompositeType compositeType = getCompositeType(initialNames, types);
    CompositeData data = new CompositeDataSupport(compositeType,
            initialNames, initialValues);
    try {
        ThreadInfo.from(data);
        fail("should throw NullPointerException");
    } catch (NullPointerException e) {
        // Expected
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:ThreadInfoTest.java

示例11: test_from_scenario7

import javax.management.openmbean.ArrayType; //导入依赖的package包/类
public void test_from_scenario7() throws Exception {
    initialValues[3] = null;
    ArrayType stackTraceArray = new ArrayType(1, stackTraceElementType);
    OpenType[] types = { SimpleType.LONG, SimpleType.STRING,
            SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
            SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
            SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
            SimpleType.STRING, stackTraceArray, SimpleType.STRING };
    CompositeType compositeType = getCompositeType(initialNames, types);
    CompositeData data = new CompositeDataSupport(compositeType,
            initialNames, initialValues);
    try {
        ThreadInfo.from(data);
        fail("should throw NullPointerException");
    } catch (NullPointerException e) {
        // Expected
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:ThreadInfoTest.java

示例12: test_from_scenario8

import javax.management.openmbean.ArrayType; //导入依赖的package包/类
public void test_from_scenario8() throws Exception {
    initialValues[4] = null;
    ArrayType stackTraceArray = new ArrayType(1, stackTraceElementType);
    OpenType[] types = { SimpleType.LONG, SimpleType.STRING,
            SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
            SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
            SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
            SimpleType.STRING, stackTraceArray, SimpleType.STRING };
    CompositeType compositeType = getCompositeType(initialNames, types);
    CompositeData data = new CompositeDataSupport(compositeType,
            initialNames, initialValues);
    try {
        ThreadInfo.from(data);
        fail("should throw NullPointerException");
    } catch (NullPointerException e) {
        // Expected
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:ThreadInfoTest.java

示例13: test_from_scenario9

import javax.management.openmbean.ArrayType; //导入依赖的package包/类
public void test_from_scenario9() throws Exception {
    initialValues[5] = null;
    ArrayType stackTraceArray = new ArrayType(1, stackTraceElementType);
    OpenType[] types = { SimpleType.LONG, SimpleType.STRING,
            SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
            SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
            SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
            SimpleType.STRING, stackTraceArray, SimpleType.STRING };
    CompositeType compositeType = getCompositeType(initialNames, types);
    CompositeData data = new CompositeDataSupport(compositeType,
            initialNames, initialValues);
    try {
        ThreadInfo.from(data);
        fail("should throw NullPointerException");
    } catch (NullPointerException e) {
        // Expected
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:ThreadInfoTest.java

示例14: test_from_scenario10

import javax.management.openmbean.ArrayType; //导入依赖的package包/类
public void test_from_scenario10() throws Exception {
    initialValues[6] = null;
    ArrayType stackTraceArray = new ArrayType(1, stackTraceElementType);
    OpenType[] types = { SimpleType.LONG, SimpleType.STRING,
            SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
            SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
            SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
            SimpleType.STRING, stackTraceArray, SimpleType.STRING };
    CompositeType compositeType = getCompositeType(initialNames, types);
    CompositeData data = new CompositeDataSupport(compositeType,
            initialNames, initialValues);
    try {
        ThreadInfo.from(data);
        fail("should throw NullPointerException");
    } catch (NullPointerException e) {
        // Expected
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:ThreadInfoTest.java

示例15: test_from_scenario11

import javax.management.openmbean.ArrayType; //导入依赖的package包/类
public void test_from_scenario11() throws Exception {
    initialValues[7] = null;
    ArrayType stackTraceArray = new ArrayType(1, stackTraceElementType);
    OpenType[] types = { SimpleType.LONG, SimpleType.STRING,
            SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
            SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
            SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
            SimpleType.STRING, stackTraceArray, SimpleType.STRING };
    CompositeType compositeType = getCompositeType(initialNames, types);
    CompositeData data = new CompositeDataSupport(compositeType,
            initialNames, initialValues);
    try {
        ThreadInfo.from(data);
        fail("should throw NullPointerException");
    } catch (NullPointerException e) {
        // Expected
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:19,代码来源:ThreadInfoTest.java


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