本文整理汇总了Java中javax.management.openmbean.OpenType.equals方法的典型用法代码示例。如果您正苦于以下问题:Java OpenType.equals方法的具体用法?Java OpenType.equals怎么用?Java OpenType.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.management.openmbean.OpenType
的用法示例。
在下文中一共展示了OpenType.equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isTypeMatched
import javax.management.openmbean.OpenType; //导入方法依赖的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;
}
示例2: isTypeMatched
import javax.management.openmbean.OpenType; //导入方法依赖的package包/类
/**
* Compares two CompositeTypes and returns true if
* all items in type1 exist in type2 and their item types
* are the same.
*/
protected static boolean isTypeMatched(CompositeType type1, CompositeType type2) {
if (type1 == type2) return true;
// We can't use CompositeType.isValue() since it returns false
// if the type name doesn't match.
Set<String> allItems = type1.keySet();
// Check all items in the type1 exist in type2
if (!type2.keySet().containsAll(allItems))
return false;
for (String item: allItems) {
OpenType<?> ot1 = type1.getType(item);
OpenType<?> ot2 = type2.getType(item);
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.equals(ot2)) {
return false;
}
}
return true;
}