Package org.springframework.aot.generate
Class GeneratedMethods
java.lang.Object
org.springframework.aot.generate.GeneratedMethods
- All Implemented Interfaces:
Iterable<GeneratedMethod>
,MethodGenerator
A managed collection of generated methods.
- Since:
- 6.0
- Author:
- Phillip Webb
- See Also:
-
Constructor Summary
ConstructorDescriptionCreate a newGeneratedMethods
instance backed by a newMethodNameGenerator
.GeneratedMethods
(MethodNameGenerator methodNameGenerator) Create a newGeneratedMethods
instance backed by the givenMethodNameGenerator
. -
Method Summary
Modifier and TypeMethodDescriptionAdd a newGeneratedMethod
.void
doWithMethodSpecs
(Consumer<org.springframework.javapoet.MethodSpec> action) Call the given action with each of theMethodSpecs
that have been added to this collection.generateMethod
(Object... methodNameParts) Generate a newGeneratedMethod
.iterator()
stream()
Return aStream
of all the methods in this collection.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.springframework.aot.generate.MethodGenerator
withName
-
Constructor Details
-
GeneratedMethods
public GeneratedMethods()Create a newGeneratedMethods
instance backed by a newMethodNameGenerator
. -
GeneratedMethods
Create a newGeneratedMethods
instance backed by the givenMethodNameGenerator
.- Parameters:
methodNameGenerator
- the method name generator
-
-
Method Details
-
generateMethod
Description copied from interface:MethodGenerator
Generate a newGeneratedMethod
. The returned instance must define the method spec by callingusing(builder -> ...)
.- Specified by:
generateMethod
in interfaceMethodGenerator
- Parameters:
methodNameParts
- the method name parts that should be used to generate a unique method name- Returns:
- the newly added
GeneratedMethod
-
add
Add a newGeneratedMethod
. The returned instance must define the method spec by callingusing(builder -> ...)
.- Parameters:
methodNameParts
- the method name parts that should be used to generate a unique method name- Returns:
- the newly added
GeneratedMethod
-
doWithMethodSpecs
Call the given action with each of theMethodSpecs
that have been added to this collection.- Parameters:
action
- the action to perform
-
iterator
- Specified by:
iterator
in interfaceIterable<GeneratedMethod>
-
stream
Return aStream
of all the methods in this collection.- Returns:
- a stream of
GeneratedMethod
instances
-