Class GeneratedType

java.lang.Object
org.springframework.aot.generator.GeneratedType

public class GeneratedType extends Object
Wrapper for a generated type.
Since:
6.0
Author:
Stephane Nicoll
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.javapoet.MethodSpec
    addMethod(org.springframework.javapoet.MethodSpec.Builder method)
    Add a method using the state of the specified MethodSpec.Builder, updating the name of the method if a similar method already exists.
    customizeType(Consumer<org.springframework.javapoet.TypeSpec.Builder> type)
    Customize the type of this instance.
    org.springframework.javapoet.ClassName
    Return the ClassName of this instance.
    of(org.springframework.javapoet.ClassName className)
    Create an instance for the specified ClassName, as a public type.
    of(org.springframework.javapoet.ClassName className, Consumer<org.springframework.javapoet.TypeSpec.Builder> type)
    Create an instance for the specified ClassName, customizing the type with the specified consumer callback.
    org.springframework.javapoet.JavaFile
    Return a JavaFile with the state of this instance.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • of

      public static GeneratedType of(org.springframework.javapoet.ClassName className, Consumer<org.springframework.javapoet.TypeSpec.Builder> type)
      Create an instance for the specified ClassName, customizing the type with the specified consumer callback.
      Parameters:
      className - the class name
      type - a callback to customize the type, i.e. to change default modifiers
      Returns:
      a new GeneratedType
    • of

      public static GeneratedType of(org.springframework.javapoet.ClassName className)
      Create an instance for the specified ClassName, as a public type.
      Parameters:
      className - the class name
      Returns:
      a new GeneratedType
    • getClassName

      public org.springframework.javapoet.ClassName getClassName()
      Return the ClassName of this instance.
      Returns:
      the class name
    • customizeType

      public GeneratedType customizeType(Consumer<org.springframework.javapoet.TypeSpec.Builder> type)
      Customize the type of this instance.
      Parameters:
      type - the consumer of the type builder
      Returns:
      this for method chaining
    • addMethod

      public org.springframework.javapoet.MethodSpec addMethod(org.springframework.javapoet.MethodSpec.Builder method)
      Add a method using the state of the specified MethodSpec.Builder, updating the name of the method if a similar method already exists.
      Parameters:
      method - a method builder representing the method to add
      Returns:
      the added method
    • toJavaFile

      public org.springframework.javapoet.JavaFile toJavaFile()
      Return a JavaFile with the state of this instance.
      Returns:
      a java file