PermissionConsistencyTest.java 文件源码

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

项目:AuthMeReloaded 作者:
/**
 * Recursively visits every MemorySection and creates a {@link PermissionDefinition} when applicable.
 *
 * @param node the node to visit
 * @param collection the collection to add constructed permission definitions to
 */
private static void addChildren(MemorySection node, Map<String, PermissionDefinition> collection) {
    // A MemorySection may have a permission entry, as well as MemorySection children
    boolean hasPermissionEntry = false;
    for (String key : node.getKeys(false)) {
        if (node.get(key) instanceof MemorySection && !"children".equals(key)) {
            addChildren((MemorySection) node.get(key), collection);
        } else if (PERMISSION_FIELDS.contains(key)) {
            hasPermissionEntry = true;
        } else {
            throw new IllegalStateException("Unexpected key '" + key + "'");
        }
    }
    if (hasPermissionEntry) {
        PermissionDefinition permDef = new PermissionDefinition(node);
        collection.put(permDef.node, permDef);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号