类 GeneratedClasses

java.lang.Object
cn.taketoday.aot.generate.GeneratedClasses

public class GeneratedClasses extends Object
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
另请参阅:
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • getOrAddForFeature

      public GeneratedClass getOrAddForFeature(String featureName, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type)
      Get or add a generated class for the specified featureName and no particular component. If this method has previously been called with the given featureName the existing class will be returned, otherwise a new class will be generated.
      参数:
      featureName - the name of the feature to associate with the generated class
      type - a Consumer used 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 specified featureName targeting the specified component. If this method has previously been called with the given featureName/target the 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 class
      targetComponent - the target component
      type - a Consumer used 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 specified featureName targeting the specified component. If this method has previously been called with the given featureName/target the 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 class
      targetComponent - the target component
      type - a Consumer used 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 specified featureName and no particular component.
      参数:
      featureName - the name of the feature to associate with the generated class
      type - a Consumer used 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 specified featureName targeting the specified component.
      参数:
      featureName - the name of the feature to associate with the generated class
      targetComponent - the target component
      type - a Consumer used 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 specified featureName targeting the specified component.
      参数:
      featureName - the name of the feature to associate with the generated class
      targetComponent - the target component
      type - a Consumer used 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

      void writeTo(GeneratedFiles generatedFiles)
      Write the generated classes using the given GeneratedFiles instance.
      参数:
      generatedFiles - where to write the generated classes
    • withFeatureNamePrefix

      GeneratedClasses withFeatureNamePrefix(String featureNamePrefix)
      Create a new GeneratedClasses instance 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