class DefaultRoleToGroupMapper implements RoleToGroupMapper {

    @Override
    public List<String> groupsFromRoles(List<String> roles) {
        if (template == null || roles == null) {
            return roles;
        } else {
            List<String> renamedRoles = new ArrayList<>();
            for (String role : roles) {
                String renamedRole = template.replace(ROLE_MAPPING_PLACEHOLDER, role);
                renamedRoles.add(renamedRole);
                LOG.debug("Mapped role {} to {}", role, renamedRole);
            }
            return renamedRoles;
        }
    }

}