From 676cddc0d901f06ca31afadb7b5acb2cb3576828 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny Date: Mon, 17 Jun 2024 10:45:31 +0200 Subject: [PATCH] Move field init to initializer, does not depend on constructor parameters --- .../libre/scim/event/ScimEventListenerProvider.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/sh/libre/scim/event/ScimEventListenerProvider.java b/src/main/java/sh/libre/scim/event/ScimEventListenerProvider.java index 0180de0621..a36dc57407 100644 --- a/src/main/java/sh/libre/scim/event/ScimEventListenerProvider.java +++ b/src/main/java/sh/libre/scim/event/ScimEventListenerProvider.java @@ -27,15 +27,16 @@ public class ScimEventListenerProvider implements EventListenerProvider { private final KeycloakSession session; - private final Map patterns = new HashMap<>(); + private final Map patterns = Map.of( + ResourceType.USER, Pattern.compile("users/(.+)"), + ResourceType.GROUP, Pattern.compile("groups/([\\w-]+)(/children)?"), + ResourceType.GROUP_MEMBERSHIP, Pattern.compile("users/(.+)/groups/(.+)"), + ResourceType.REALM_ROLE_MAPPING, Pattern.compile("^(.+)/(.+)/role-mappings") + ); public ScimEventListenerProvider(KeycloakSession session) { this.session = session; dispatcher = new ScimDispatcher(session); - patterns.put(ResourceType.USER, Pattern.compile("users/(.+)")); - patterns.put(ResourceType.GROUP, Pattern.compile("groups/([\\w-]+)(/children)?")); - patterns.put(ResourceType.GROUP_MEMBERSHIP, Pattern.compile("users/(.+)/groups/(.+)")); - patterns.put(ResourceType.REALM_ROLE_MAPPING, Pattern.compile("^(.+)/(.+)/role-mappings")); } @Override