Class GeneratedClass

java.lang.Object
org.springframework.aot.generate.GeneratedClass

public final class GeneratedClass extends Object
A single generated class.
Since:
6.0
Author:
Phillip Webb, Stephane Nicoll
See Also:
  • Method Details

    • 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.
      Parameters:
      reservedMethodNames - the reserved method names
    • getEnclosingClass

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

      public org.springframework.javapoet.ClassName getName()
      Return the name of the generated class.
      Returns:
      the name of the generated class
    • getMethods

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

      public GeneratedClass getOrAdd(String name, Consumer<org.springframework.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.
      Parameters:
      name - the name of the nested class
      type - a Consumer used to build the type
      Returns:
      an existing or newly generated class whose enclosing class is this class