@@ -156,6 +156,7 @@ public static class ServiceCollector {
156
156
157
157
@ Nullable
158
158
private Set <String > serviceNamesCache ;
159
+ private Map <String , Set <String >> serviceClassNameCache ;
159
160
160
161
private ServiceCollector (@ NotNull Project project ) {
161
162
this .project = project ;
@@ -333,23 +334,25 @@ private Map<String, ContainerService> collectDecorated(@NotNull Collection<Servi
333
334
}
334
335
335
336
public Set <String > convertClassNameToServices (@ NotNull String fqnClassName ) {
336
-
337
- Set <String > serviceNames = new HashSet <>();
338
-
339
- fqnClassName = StringUtils .stripStart (fqnClassName , "\\ " );
340
-
341
- for (Map .Entry <String , ContainerService > entry : this .getServices ().entrySet ()) {
342
- for (String className : entry .getValue ().getClassNames ()) {
343
- String indexedClassName = this .getParameterCollector ().resolve (className );
344
- if (indexedClassName != null ) {
345
- if (StringUtils .stripStart (indexedClassName , "\\ " ).equalsIgnoreCase (fqnClassName )) {
346
- serviceNames .add (entry .getKey ());
337
+ if (this .serviceClassNameCache == null ) {
338
+ Map <String , Set <String >> result = new HashMap <>();
339
+ for (Map .Entry <String , ContainerService > entry : this .getServices ().entrySet ()) {
340
+ for (String className : entry .getValue ().getClassNames ()) {
341
+ String indexedClassName = this .getParameterCollector ().resolve (className );
342
+ if (indexedClassName != null ) {
343
+ indexedClassName = "\\ " + StringUtils .stripStart (indexedClassName , "\\ " );
344
+
345
+ result .putIfAbsent (indexedClassName , new HashSet <>());
346
+ result .get (indexedClassName ).add (entry .getKey ());
347
347
}
348
348
}
349
349
}
350
+
351
+ this .serviceClassNameCache = result ;
350
352
}
351
353
352
- return serviceNames ;
354
+ fqnClassName = "\\ " + StringUtils .stripStart (fqnClassName , "\\ " );
355
+ return this .serviceClassNameCache .getOrDefault (fqnClassName , Collections .emptySet ());
353
356
}
354
357
355
358
private Set <String > getNames () {
0 commit comments