类 GeneratedMethods
- 从以下版本开始:
- 4.0
- 作者:
- Phillip Webb, Stephane Nicoll
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明private final cn.taketoday.javapoet.ClassNameprivate final List<GeneratedMethod>private final Function<MethodName,String> private final MethodName -
构造器概要
构造器限定符构造器说明(专用程序包)GeneratedMethods(cn.taketoday.javapoet.ClassName className, Function<MethodName, String> methodNameGenerator) Create a newGeneratedMethodsusing the specified method name generator.privateGeneratedMethods(cn.taketoday.javapoet.ClassName className, Function<MethodName, String> methodNameGenerator, MethodName prefix, List<GeneratedMethod> generatedMethods) -
方法概要
修饰符和类型方法说明Add a newGeneratedMethod.Add a newGeneratedMethod.(专用程序包) voiddoWithMethodSpecs(Consumer<cn.taketoday.javapoet.MethodSpec> action) Call the given action with each of theMethodSpecsthat have been added to this collection.(专用程序包) Stream<GeneratedMethod>stream()withPrefix(String prefix) Specify the prefix to use for method names.
-
字段详细资料
-
className
private final cn.taketoday.javapoet.ClassName className -
methodNameGenerator
-
prefix
-
generatedMethods
-
-
构造器详细资料
-
GeneratedMethods
GeneratedMethods(cn.taketoday.javapoet.ClassName className, Function<MethodName, String> methodNameGenerator) Create a newGeneratedMethodsusing the specified method name generator.- 参数:
className- the declaring class namemethodNameGenerator- the method name generator
-
GeneratedMethods
private GeneratedMethods(cn.taketoday.javapoet.ClassName className, Function<MethodName, String> methodNameGenerator, MethodName prefix, List<GeneratedMethod> generatedMethods)
-
-
方法详细资料
-
add
public GeneratedMethod add(String suggestedName, Consumer<cn.taketoday.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.- 参数:
suggestedName- the suggested name for the methodmethod- aConsumerused to build method- 返回:
- the newly added
GeneratedMethod
-
add
public GeneratedMethod add(String[] suggestedNameParts, Consumer<cn.taketoday.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.- 参数:
suggestedNameParts- the suggested name parts for the methodmethod- aConsumerused to build method- 返回:
- 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.- 参数:
prefix- the prefix to add to suggested method names- 返回:
- a new instance with the specified prefix
-
doWithMethodSpecs
Call the given action with each of theMethodSpecsthat have been added to this collection.- 参数:
action- the action to perform
-
stream
Stream<GeneratedMethod> stream()
-