class AclFactory {

    public Map<PatternHolder, Set<String>> parseAcl(Buffer buffer) throws ValidationException {
        ValidationResult validationResult = Validator.validateStatic(buffer, aclSchema, log);
        if (!validationResult.isSuccess()) {
            throw new ValidationException(validationResult);
        }

        Map<PatternHolder, Set<String>> result = new HashMap<>();
        JsonObject aclItems = new JsonObject(buffer.toString("UTF-8"));

        for (String id : aclItems.fieldNames()) {
            Object aclItemToTest = aclItems.getValue(id);
            if (!(aclItemToTest instanceof JsonObject)) {
                throw new ValidationException("acl item must be a map: " + id);
            }
            JsonObject aclItem = aclItems.getJsonObject(id);
            aclItems.getValue("debug.read");
            String path = aclItem.getString("path");
            JsonArray methods = aclItem.getJsonArray("methods");
            checkPropertiesValid(path, methods, id);
            if (path != null) {
                PatternHolder holder = new PatternHolder(Pattern.compile(path));
                Set<String> methodSet = result.get(holder);
                if (methodSet == null) {
                    methodSet = new HashSet<>();
                    result.put(holder, methodSet);
                }
                if (methods != null) {
                    for (Object methodObj : methods) {
                        String method = (String) methodObj;
                        methodSet.add(method);
                    }
                }
            }
        }
        return result;
    }

    public  AclFactory();

}