本文整理汇总了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);
}
示例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;
}
}
示例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;
}
示例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);
}
}
示例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
};
}
示例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;
}
示例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
}
}
示例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
}
}
示例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
}
}
示例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
}
}
示例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
}
}
示例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
}
}
示例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
}
}
示例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
}
}
示例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
}
}