Java Code Examples for javax.management.openmbean.CompositeType#getType()

The following examples show how to use javax.management.openmbean.CompositeType#getType() . 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 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 2
Source File: VMOptionOpenDataTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void validateType(CompositeData data) {
    CompositeType type = data.getCompositeType();
    Set<String> keys = Arrays.stream(names).collect(Collectors.toSet());
    if (!type.keySet().equals(keys)) {
        throw new RuntimeException("key not matched: " + type.keySet().toString());
    }
    for (int i=0; i < names.length; i++) {
        OpenType t = type.getType(names[i]);
        if (t != types[i]) {
            throw new AssertionError(names[i] + ": type not matched: " +
                t + " expected: " + types[i]);
        }
    }
}
 
Example 3
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 4
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 5
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 6
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 7
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 8
Source File: ModelControllerMBeanTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private OpenType<?> assertCompositeType(CompositeType composite, String name, String type, String description, boolean validateType) {
    Assert.assertTrue(composite.keySet().contains(name));
    if (validateType) {
        Assert.assertEquals(type, composite.getType(name).getTypeName());
    }
    Assert.assertEquals(description, composite.getDescription(name));
    return composite.getType(name);
}
 
Example 9
Source File: ExpressionTypeConverterUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private OpenType<?> assertCompositeType(CompositeType composite, String name, String type, String description, boolean validateType){
    Assert.assertTrue(composite.keySet().contains(name));
    if (validateType) {
        Assert.assertEquals(type, composite.getType(name).getTypeName());
    }
    Assert.assertEquals(description, composite.getDescription(name));
    return composite.getType(name);
}
 
Example 10
Source File: LegacyTypeConverterUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private OpenType<?> assertCompositeType(CompositeType composite, String name, String type, String description, boolean validateType){
    Assert.assertTrue(composite.keySet().contains(name));
    if (validateType) {
        Assert.assertEquals(type, composite.getType(name).getTypeName());
    }
    Assert.assertEquals(description, composite.getDescription(name));
    return composite.getType(name);
}