Package org.springframework.aot.generate
Class ClassNameGenerator
java.lang.Object
org.springframework.aot.generate.ClassNameGenerator
Generate unique class names based on a target 
ClassName and a
 feature name.
 This class is stateful, so the same instance should be used for all name generation.
- Since:
- 6.0
- Author:
- Phillip Webb, Stephane Nicoll
- 
Constructor SummaryConstructorsConstructorDescriptionClassNameGenerator(org.springframework.javapoet.ClassName defaultTarget) Create a new instance using the specifieddefaultTargetand no feature name prefix.ClassNameGenerator(org.springframework.javapoet.ClassName defaultTarget, String featureNamePrefix) Create a new instance using the specifieddefaultTargetand feature name prefix.
- 
Method SummaryModifier and TypeMethodDescriptionorg.springframework.javapoet.ClassNamegenerateClassName(String featureName, org.springframework.javapoet.ClassName target) Generate a uniqueClassNamebased on the specifiedfeatureNameandtarget.
- 
Constructor Details- 
ClassNameGeneratorpublic ClassNameGenerator(org.springframework.javapoet.ClassName defaultTarget) Create a new instance using the specifieddefaultTargetand no feature name prefix.- Parameters:
- defaultTarget- the default target class to use
 
- 
ClassNameGeneratorpublic ClassNameGenerator(org.springframework.javapoet.ClassName defaultTarget, String featureNamePrefix) Create a new instance using the specifieddefaultTargetand feature name prefix.- Parameters:
- defaultTarget- the default target class to use
- featureNamePrefix- the prefix to use to qualify feature names
 
 
- 
- 
Method Details- 
generateClassNamepublic org.springframework.javapoet.ClassName generateClassName(String featureName, @Nullable org.springframework.javapoet.ClassName target) Generate a uniqueClassNamebased on the specifiedfeatureNameandtarget. If thetargetisnull, the configured main target of this instance is used.The class name is a suffixed version of the target. For instance, a com.example.Demotarget with anInitializerfeature name leads to acom.example.Demo__Initializergenerated class name. The feature name is qualified by the configured feature name prefix, if any.Generated class names are unique. If such a feature was already requested for this target, a counter is used to ensure uniqueness. - Parameters:
- featureName- the name of the feature that the generated class supports
- target- the class the newly generated class relates to, or- nullto use the main target
- Returns:
- a unique generated class name
 
 
-