Skip to content

Commit

Permalink
Make GeneratedClasses#withFeatureNamePrefix(String) public
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Jul 15, 2023
1 parent 4a8e923 commit 361344f
Showing 1 changed file with 14 additions and 6 deletions.
@@ -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.
Expand Down Expand Up @@ -176,6 +176,19 @@ public GeneratedClass addForFeatureComponent(String featureName,
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) {

Expand All @@ -199,11 +212,6 @@ void writeTo(GeneratedFiles generatedFiles) {
}
}

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) {
}

Expand Down

0 comments on commit 361344f

Please sign in to comment.