Class GeneratedType
java.lang.Object
org.springframework.aot.generator.GeneratedType
Wrapper for a generated type.
- Since:
- 6.0
- Author:
- Stephane Nicoll
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.javapoet.MethodSpec
addMethod
(org.springframework.javapoet.MethodSpec.Builder method) Add a method using the state of the specifiedMethodSpec.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 theClassName
of this instance.static GeneratedType
of
(org.springframework.javapoet.ClassName className) Create an instance for the specifiedClassName
, as apublic
type.static GeneratedType
of
(org.springframework.javapoet.ClassName className, Consumer<org.springframework.javapoet.TypeSpec.Builder> type) Create an instance for the specifiedClassName
, customizing the type with the specifiedconsumer callback
.org.springframework.javapoet.JavaFile
Return aJavaFile
with the state of this instance.
-
Method Details
-
of
public static GeneratedType of(org.springframework.javapoet.ClassName className, Consumer<org.springframework.javapoet.TypeSpec.Builder> type) Create an instance for the specifiedClassName
, customizing the type with the specifiedconsumer callback
.- Parameters:
className
- the class nametype
- a callback to customize the type, i.e. to change default modifiers- Returns:
- a new
GeneratedType
-
of
Create an instance for the specifiedClassName
, as apublic
type.- Parameters:
className
- the class name- Returns:
- a new
GeneratedType
-
getClassName
public org.springframework.javapoet.ClassName getClassName()Return theClassName
of this instance.- Returns:
- the class name
-
customizeType
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 specifiedMethodSpec.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 aJavaFile
with the state of this instance.- Returns:
- a java file
-