Browse Source

Make GeneratedClasses#withFeatureNamePrefix(String) public

See gh-30861
Closes gh-30897
pull/30915/head
Sam Brannen 2 years ago
parent
commit
c354b1014d
  1. 20
      spring-core/src/main/java/org/springframework/aot/generate/GeneratedClasses.java

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -176,6 +176,19 @@ public class GeneratedClasses { @@ -176,6 +176,19 @@ public class GeneratedClasses {
return addForFeatureComponent(featureName, ClassName.get(targetComponent), type);
}
/**
* Create a new {@link GeneratedClasses} instance using the specified feature
* name prefix to qualify generated class names for a dedicated round of code
* generation.
* @param featureNamePrefix the feature name prefix to use
* @return a new instance for the specified feature name prefix
* @since 6.0.12
*/
public GeneratedClasses withFeatureNamePrefix(String featureNamePrefix) {
return new GeneratedClasses(this.classNameGenerator.withFeatureNamePrefix(featureNamePrefix),
this.classes, this.classesByOwner);
}
private GeneratedClass createAndAddGeneratedClass(String featureName,
@Nullable ClassName targetComponent, Consumer<TypeSpec.Builder> type) {
@ -199,11 +212,6 @@ public class GeneratedClasses { @@ -199,11 +212,6 @@ public class GeneratedClasses {
}
}
GeneratedClasses withFeatureNamePrefix(String name) {
return new GeneratedClasses(this.classNameGenerator.withFeatureNamePrefix(name),
this.classes, this.classesByOwner);
}
private record Owner(String featureNamePrefix, String featureName, @Nullable ClassName target) {
}

Loading…
Cancel
Save