Java Code Examples for javax.management.openmbean.OpenType#equals()

The following examples show how to use javax.management.openmbean.OpenType#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LazyCompositeData.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: LazyCompositeData.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: LazyCompositeData.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 4
Source File: LazyCompositeData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 5
Source File: LazyCompositeData.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 6
Source File: LazyCompositeData.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 7
Source File: LazyCompositeData.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 8
Source File: LazyCompositeData.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 9
Source File: LazyCompositeData.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 10
Source File: LazyCompositeData.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 11
Source File: LazyCompositeData.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 12
Source File: LazyCompositeData.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 13
Source File: LazyCompositeData.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 14
Source File: DynamicMBeanFactory.java    From datakernel with Apache License 2.0 5 votes vote down vote up
private static MBeanAttributeInfo[] fetchAttributesInfo(AttributeNodeForPojo rootNode) {
	Set<String> visibleAttrs = rootNode.getVisibleAttributes();
	Map<String, OpenType<?>> nameToType = rootNode.getOpenTypes();
	Map<String, Map<String, String>> nameToDescriptions = rootNode.getDescriptions();
	List<MBeanAttributeInfo> attrsInfo = new ArrayList<>();
	for (String attrName : visibleAttrs) {
		String description = createDescription(attrName, nameToDescriptions.get(attrName));
		OpenType<?> attrType = nameToType.get(attrName);
		boolean writable = rootNode.isSettable(attrName);
		boolean isIs = attrType.equals(SimpleType.BOOLEAN);
		attrsInfo.add(new MBeanAttributeInfo(attrName, attrType.getClassName(), description, true, writable, isIs));
	}

	return attrsInfo.toArray(new MBeanAttributeInfo[0]);
}