Merge branch '6.0.x'
This commit is contained in:
@@ -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.
|
||||
@@ -78,7 +78,7 @@ public class DefaultGenerationContext implements GenerationContext {
|
||||
* @param generatedFiles the generated files
|
||||
* @param runtimeHints the runtime hints
|
||||
*/
|
||||
DefaultGenerationContext(GeneratedClasses generatedClasses,
|
||||
protected DefaultGenerationContext(GeneratedClasses generatedClasses,
|
||||
GeneratedFiles generatedFiles, RuntimeHints runtimeHints) {
|
||||
|
||||
Assert.notNull(generatedClasses, "'generatedClasses' must not be null");
|
||||
|
||||
@@ -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 {
|
||||
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 {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user