Skip to content

Commit c354b10

Browse files
committed
Make GeneratedClasses#withFeatureNamePrefix(String) public
See gh-30861 Closes gh-30897
1 parent a28ec3a commit c354b10

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

spring-core/src/main/java/org/springframework/aot/generate/GeneratedClasses.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -176,6 +176,19 @@ public GeneratedClass addForFeatureComponent(String featureName,
176176
return addForFeatureComponent(featureName, ClassName.get(targetComponent), type);
177177
}
178178

179+
/**
180+
* Create a new {@link GeneratedClasses} instance using the specified feature
181+
* name prefix to qualify generated class names for a dedicated round of code
182+
* generation.
183+
* @param featureNamePrefix the feature name prefix to use
184+
* @return a new instance for the specified feature name prefix
185+
* @since 6.0.12
186+
*/
187+
public GeneratedClasses withFeatureNamePrefix(String featureNamePrefix) {
188+
return new GeneratedClasses(this.classNameGenerator.withFeatureNamePrefix(featureNamePrefix),
189+
this.classes, this.classesByOwner);
190+
}
191+
179192
private GeneratedClass createAndAddGeneratedClass(String featureName,
180193
@Nullable ClassName targetComponent, Consumer<TypeSpec.Builder> type) {
181194

@@ -199,11 +212,6 @@ void writeTo(GeneratedFiles generatedFiles) {
199212
}
200213
}
201214

202-
GeneratedClasses withFeatureNamePrefix(String name) {
203-
return new GeneratedClasses(this.classNameGenerator.withFeatureNamePrefix(name),
204-
this.classes, this.classesByOwner);
205-
}
206-
207215
private record Owner(String featureNamePrefix, String featureName, @Nullable ClassName target) {
208216
}
209217

0 commit comments

Comments
 (0)