Class GeneratedMethods
- Since:
- 6.0
- Author:
- Phillip Webb, Stephane Nicoll
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionAdd a newGeneratedMethod.Add a newGeneratedMethod.withPrefix(String prefix) Specify the prefix to use for method names.
-
Method Details
-
add
public GeneratedMethod add(String suggestedName, Consumer<org.springframework.javapoet.MethodSpec.Builder> method) Add a newGeneratedMethod.The
suggestedNameshould provide the unqualified form of what the method does. For instance, if the method returns an instance of a given type,getInstancecan be used as it is automatically qualified using the current prefix.The prefix is applied a little differently for suggested names that start with
get,set, oris. Taking the previous example with amyBeanprefix, the actual method name isgetMyBeanInstance. Further processing of the method can happen to ensure uniqueness within a class.- Parameters:
suggestedName- the suggested name for the methodmethod- aConsumerused to build method- Returns:
- the newly added
GeneratedMethod
-
add
public GeneratedMethod add(String[] suggestedNameParts, Consumer<org.springframework.javapoet.MethodSpec.Builder> method) Add a newGeneratedMethod.The
suggestedNamePartsshould provide the unqualified form of what the method does. For instance, if the method returns an instance of a given type,["get", "instance"]can be used as it is automatically qualified using the current prefix.The prefix is applied a little differently for suggested name parts that start with
get,set, oris. Taking the previous example with amyBeanprefix, the actual method name isgetMyBeanInstance. Further processing of the method can happen to ensure uniqueness within a class.- Parameters:
suggestedNameParts- the suggested name parts for the methodmethod- aConsumerused to build method- Returns:
- the newly added
GeneratedMethod
-
withPrefix
Specify the prefix to use for method names. The prefix applies to suggested method names, with special handling ofget,set, andisprefixes in the suggested name itself.- Parameters:
prefix- the prefix to add to suggested method names- Returns:
- a new instance with the specified prefix
-