Make GeneratedClasses#withFeatureNamePrefix(String) public
See gh-30861 Closes gh-30897
This commit is contained in:
parent
a28ec3a0a8
commit
c354b1014d
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -176,6 +176,19 @@ public class GeneratedClasses {
|
||||||
return addForFeatureComponent(featureName, ClassName.get(targetComponent), type);
|
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,
|
private GeneratedClass createAndAddGeneratedClass(String featureName,
|
||||||
@Nullable ClassName targetComponent, Consumer<TypeSpec.Builder> type) {
|
@Nullable ClassName targetComponent, Consumer<TypeSpec.Builder> type) {
|
||||||
|
|
||||||
|
@ -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) {
|
private record Owner(String featureNamePrefix, String featureName, @Nullable ClassName target) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue