class RoleMapperFactory {

    public List<RoleMapperHolder> parseRoleMapper(Buffer buffer) throws ValidationException {
        ValidationResult validationResult = Validator.validateStatic(buffer, mapperSchema, LOGGER);
        if (!validationResult.isSuccess()) {
            throw new ValidationException(validationResult);
        }

        List<RoleMapperHolder> result = new ArrayList<>();
        Mappings mappings = Json.decodeValue(buffer, Mappings.class);
        for (Mapping mapping : mappings.mappings) {
            if (properties != null) {
                mapping.pattern = StringUtils.replaceWildcardConfigs(mapping.pattern, properties);
                mapping.role = StringUtils.replaceWildcardConfigs(mapping.role, properties);
            }
            result.add(new RoleMapperHolder(Pattern.compile(mapping.pattern), mapping.role, mapping.keepOriginalRole, mapping.continueMapping, mapping.keepResultingRole));
        }
        return result;
    }

      RoleMapperFactory(Map<String, Object> properties);

}