Package org.springframework.aot.generate
Class GeneratedClass
java.lang.Object
org.springframework.aot.generate.GeneratedClass
A single generated class.
- Since:
- 6.0
- Author:
- Phillip Webb, Stephane Nicoll
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturn the enclosingGeneratedClass
ornull
if this instance represents a top-level class.Return generated methods for this instance.org.springframework.javapoet.ClassName
getName()
Return the name of the generated class.Get or add a nested generated class with the specified name.void
reserveMethodNames
(String... reservedMethodNames) Update this instance with a set of reserved method names that should not be used for generated methods.
-
Method Details
-
reserveMethodNames
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
Return the enclosingGeneratedClass
ornull
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
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 givenname
, the existing class will be returned, otherwise a new class will be generated.- Parameters:
name
- the name of the nested classtype
- aConsumer
used to build the type- Returns:
- an existing or newly generated class whose enclosing class is this class
-