Class DefaultGeneratedTypeContext

java.lang.Object
org.springframework.aot.generator.DefaultGeneratedTypeContext
All Implemented Interfaces:
GeneratedTypeContext

public class DefaultGeneratedTypeContext extends Object implements GeneratedTypeContext
Default GeneratedTypeContext implementation.
Since:
6.0
Author:
Stephane Nicoll
  • Constructor Details

    • DefaultGeneratedTypeContext

      public DefaultGeneratedTypeContext(String packageName, Function<String,GeneratedType> generatedTypeFactory)
      Create a context targeting the specified package name and using the specified factory to create a GeneratedType per requested package name.
      Parameters:
      packageName - the main package name
      generatedTypeFactory - the factory to use to create a GeneratedType based on a package name.
  • Method Details

    • runtimeHints

      public RuntimeHints runtimeHints()
      Description copied from interface: GeneratedTypeContext
      Return the RuntimeHints instance to use to contribute hints for generated types.
      Specified by:
      runtimeHints in interface GeneratedTypeContext
      Returns:
      the runtime hints
    • getGeneratedType

      public GeneratedType getGeneratedType(String packageName)
      Description copied from interface: GeneratedTypeContext
      Return a GeneratedType for the specified package. If it does not exist, it is created.
      Specified by:
      getGeneratedType in interface GeneratedTypeContext
      Parameters:
      packageName - the package name to use
      Returns:
      a generated type
    • getMainGeneratedType

      public GeneratedType getMainGeneratedType()
      Description copied from interface: GeneratedTypeContext
      Return the main GeneratedType.
      Specified by:
      getMainGeneratedType in interface GeneratedTypeContext
      Returns:
      the generated type for the target package
    • hasGeneratedType

      public boolean hasGeneratedType(String packageName)
      Specify if a GeneratedType for the specified package name is registered.
      Parameters:
      packageName - the package name to use
      Returns:
      true if a type is registered for that package
    • toJavaFiles

      public List<org.springframework.javapoet.JavaFile> toJavaFiles()
      Return the list of JavaFile of known generated type.
      Returns:
      the java files of bootstrap classes in this instance