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
ConstructorsConstructorDescriptionCreate a newGeneratedMethodsinstance backed by a newMethodNameGenerator.GeneratedMethods(MethodNameGenerator methodNameGenerator) Create a newGeneratedMethodsinstance backed by the givenMethodNameGenerator. -
Method Summary
Modifier and TypeMethodDescriptionAdd a newGeneratedMethod.voiddoWithMethodSpecs(Consumer<org.springframework.javapoet.MethodSpec> action) Call the given action with each of theMethodSpecsthat have been added to this collection.generateMethod(Object... methodNameParts) Generate a newGeneratedMethod.iterator()stream()Return aStreamof all the methods in this collection.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.springframework.aot.generate.MethodGenerator
withName
-
Constructor Details
-
GeneratedMethods
public GeneratedMethods()Create a newGeneratedMethodsinstance backed by a newMethodNameGenerator. -
GeneratedMethods
Create a newGeneratedMethodsinstance backed by the givenMethodNameGenerator.- Parameters:
methodNameGenerator- the method name generator
-
-
Method Details
-
generateMethod
Description copied from interface:MethodGeneratorGenerate a newGeneratedMethod. The returned instance must define the method spec by callingusing(builder -> ...).- Specified by:
generateMethodin 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 theMethodSpecsthat have been added to this collection.- Parameters:
action- the action to perform
-
iterator
- Specified by:
iteratorin interfaceIterable<GeneratedMethod>
-
stream
Return aStreamof all the methods in this collection.- Returns:
- a stream of
GeneratedMethodinstances
-