类 GeneratedClass

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

public final class GeneratedClass extends Object
A single generated class.
从以下版本开始:
4.0
作者:
Phillip Webb, Stephane Nicoll
另请参阅:
  • 字段详细资料

    • enclosingClass

      @Nullable private final GeneratedClass enclosingClass
    • name

      private final cn.taketoday.javapoet.ClassName name
    • methods

      private final GeneratedMethods methods
    • type

      private final Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type
    • declaredClasses

      private final Map<cn.taketoday.javapoet.ClassName,GeneratedClass> declaredClasses
    • methodNameSequenceGenerator

      private final Map<MethodName,AtomicInteger> methodNameSequenceGenerator
  • 构造器详细资料

    • GeneratedClass

      GeneratedClass(cn.taketoday.javapoet.ClassName name, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type)
      Create a new GeneratedClass instance with the given name. This constructor is package-private since names should only be generated via a GeneratedClasses.
      参数:
      name - the generated name
      type - a Consumer used to build the type
    • GeneratedClass

      private GeneratedClass(@Nullable GeneratedClass enclosingClass, cn.taketoday.javapoet.ClassName name, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type)
  • 方法详细资料

    • reserveMethodNames

      public void reserveMethodNames(String... reservedMethodNames)
      Update this instance with a set of reserved method names that should not be used for generated methods. Reserved names are often needed when a generated class implements a specific interface.
      参数:
      reservedMethodNames - the reserved method names
    • generateSequencedMethodName

      private String generateSequencedMethodName(MethodName name)
    • getEnclosingClass

      @Nullable public GeneratedClass getEnclosingClass()
      Return the enclosing GeneratedClass or null if this instance represents a top-level class.
      返回:
      the enclosing generated class, if any
    • getName

      public cn.taketoday.javapoet.ClassName getName()
      Return the name of the generated class.
      返回:
      the name of the generated class
    • getMethods

      public GeneratedMethods getMethods()
      Return generated methods for this instance.
      返回:
      the generated methods
    • getOrAdd

      public GeneratedClass getOrAdd(String name, Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type)
      Get or add a nested generated class with the specified name. If this method has previously been called with the given name, the existing class will be returned, otherwise a new class will be generated.
      参数:
      name - the name of the nested class
      type - a Consumer used to build the type
      返回:
      an existing or newly generated class whose enclosing class is this class
    • generateJavaFile

      cn.taketoday.javapoet.JavaFile generateJavaFile()
    • apply

      private cn.taketoday.javapoet.TypeSpec.Builder apply()
    • getBuilder

      private cn.taketoday.javapoet.TypeSpec.Builder getBuilder(Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type)
    • assertSameType

      void assertSameType(Consumer<cn.taketoday.javapoet.TypeSpec.Builder> type)