PermissionConsistencyTest.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:AuthMeReloaded 作者:
/**
 * Recursively walks through the given memory section to gather all keys.
 * Assumes that the ending value is a boolean and throws an exception otherwise.
 *
 * @param parentSection the memory section to traverse
 * @param children list to add all results to
 */
private static void collectChildren(MemorySection parentSection, List<String> children) {
    for (Map.Entry<String, Object> entry : parentSection.getValues(false).entrySet()) {
        if (entry.getValue() instanceof MemorySection) {
            collectChildren((MemorySection) entry.getValue(), children);
        } else if (entry.getValue() instanceof Boolean) {
            if (!Boolean.TRUE.equals(entry.getValue())) {
                throw new IllegalStateException("Child entry '" + entry.getKey()
                    + "' has unexpected value '" + entry.getValue() + "'");
            }
            children.add(parentSection.getCurrentPath() + "." + entry.getKey());
        } else {
            throw new IllegalStateException("Found child entry at '" + entry.getKey() + "' with value "
                + "of unexpected type: '" + parentSection.getCurrentPath() + "." + entry.getValue() + "'");
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号