类 GeneratedClasses
java.lang.Object
cn.taketoday.aot.generate.GeneratedClasses
A managed collection of generated classes.
This class is stateful, so the same instance should be used for all class generation.
- 从以下版本开始:
- 4.0
- 作者:
- Phillip Webb, Stephane Nicoll, Harry Yang
- 另请参阅:
-
嵌套类概要
嵌套类 -
字段概要
字段修饰符和类型字段说明private final List<GeneratedClass>private final Map<GeneratedClasses.Owner,GeneratedClass> private final ClassNameGenerator -
构造器概要
构造器限定符构造器说明(专用程序包)GeneratedClasses(ClassNameGenerator classNameGenerator) Create a new instance using the specified naming conventions.privateGeneratedClasses(ClassNameGenerator classNameGenerator, List<GeneratedClass> classes, Map<GeneratedClasses.Owner, GeneratedClass> classesByOwner) -
方法概要
修饰符和类型方法说明addForFeature(String featureName, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type) Add a new generated class for the specifiedfeatureNameand no particular component.addForFeatureComponent(String featureName, cn.taketoday.javapoet.ClassName targetComponent, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type) Add a new generated class for the specifiedfeatureNametargeting the specifiedcomponent.addForFeatureComponent(String featureName, Class<?> targetComponent, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type) Add a new generated class for the specifiedfeatureNametargeting the specifiedcomponent.private GeneratedClasscreateAndAddGeneratedClass(String featureName, cn.taketoday.javapoet.ClassName targetComponent, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type) getOrAddForFeature(String featureName, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type) Get or add a generated class for the specifiedfeatureNameand no particular component.getOrAddForFeatureComponent(String featureName, cn.taketoday.javapoet.ClassName targetComponent, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type) Get or add a generated class for the specifiedfeatureNametargeting the specifiedcomponent.getOrAddForFeatureComponent(String featureName, Class<?> targetComponent, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type) Get or add a generated class for the specifiedfeatureNametargeting the specifiedcomponent.(专用程序包) GeneratedClasseswithFeatureNamePrefix(String featureNamePrefix) Create a newGeneratedClassesinstance using the specified feature name prefix to qualify generated class names for a dedicated round of code generation.(专用程序包) voidwriteTo(GeneratedFiles generatedFiles) Write thegenerated classesusing the givenGeneratedFilesinstance.
-
字段详细资料
-
classNameGenerator
-
classes
-
classesByOwner
-
-
构造器详细资料
-
GeneratedClasses
GeneratedClasses(ClassNameGenerator classNameGenerator) Create a new instance using the specified naming conventions.- 参数:
classNameGenerator- the class name generator to use
-
GeneratedClasses
private GeneratedClasses(ClassNameGenerator classNameGenerator, List<GeneratedClass> classes, Map<GeneratedClasses.Owner, GeneratedClass> classesByOwner)
-
-
方法详细资料
-
getOrAddForFeature
public GeneratedClass getOrAddForFeature(String featureName, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type) Get or add a generated class for the specifiedfeatureNameand no particular component. If this method has previously been called with the givenfeatureNamethe existing class will be returned, otherwise a new class will be generated.- 参数:
featureName- the name of the feature to associate with the generated classtype- aConsumerused to build the type- 返回:
- an existing or newly generated class
-
getOrAddForFeatureComponent
public GeneratedClass getOrAddForFeatureComponent(String featureName, cn.taketoday.javapoet.ClassName targetComponent, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type) Get or add a generated class for the specifiedfeatureNametargeting the specifiedcomponent. If this method has previously been called with the givenfeatureName/targetthe existing class will be returned, otherwise a new class will be generated, otherwise a new class will be generated.- 参数:
featureName- the name of the feature to associate with the generated classtargetComponent- the target componenttype- aConsumerused to build the type- 返回:
- an existing or newly generated class
-
getOrAddForFeatureComponent
public GeneratedClass getOrAddForFeatureComponent(String featureName, Class<?> targetComponent, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type) Get or add a generated class for the specifiedfeatureNametargeting the specifiedcomponent. If this method has previously been called with the givenfeatureName/targetthe existing class will be returned, otherwise a new class will be generated, otherwise a new class will be generated.- 参数:
featureName- the name of the feature to associate with the generated classtargetComponent- the target componenttype- aConsumerused to build the type- 返回:
- an existing or newly generated class
-
addForFeature
public GeneratedClass addForFeature(String featureName, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type) Add a new generated class for the specifiedfeatureNameand no particular component.- 参数:
featureName- the name of the feature to associate with the generated classtype- aConsumerused to build the type- 返回:
- the newly generated class
-
addForFeatureComponent
public GeneratedClass addForFeatureComponent(String featureName, cn.taketoday.javapoet.ClassName targetComponent, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type) Add a new generated class for the specifiedfeatureNametargeting the specifiedcomponent.- 参数:
featureName- the name of the feature to associate with the generated classtargetComponent- the target componenttype- aConsumerused to build the type- 返回:
- the newly generated class
-
addForFeatureComponent
public GeneratedClass addForFeatureComponent(String featureName, Class<?> targetComponent, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type) Add a new generated class for the specifiedfeatureNametargeting the specifiedcomponent.- 参数:
featureName- the name of the feature to associate with the generated classtargetComponent- the target componenttype- aConsumerused to build the type- 返回:
- the newly generated class
-
createAndAddGeneratedClass
private GeneratedClass createAndAddGeneratedClass(String featureName, @Nullable cn.taketoday.javapoet.ClassName targetComponent, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type) -
writeTo
Write thegenerated classesusing the givenGeneratedFilesinstance.- 参数:
generatedFiles- where to write the generated classes
-
withFeatureNamePrefix
Create a newGeneratedClassesinstance using the specified feature name prefix to qualify generated class names for a dedicated round of code generation.- 参数:
featureNamePrefix- the feature name prefix to use- 返回:
- a new instance for the specified feature name prefix
-