类 GeneratedMethods

java.lang.Object
cn.taketoday.aot.generate.GeneratedMethods

public class GeneratedMethods extends Object
A managed collection of generated methods.
从以下版本开始:
4.0
作者:
Phillip Webb, Stephane Nicoll
另请参阅:
  • 字段详细资料

    • className

      private final cn.taketoday.javapoet.ClassName className
    • methodNameGenerator

      private final Function<MethodName,String> methodNameGenerator
    • prefix

      private final MethodName prefix
    • generatedMethods

      private final List<GeneratedMethod> generatedMethods
  • 构造器详细资料

    • GeneratedMethods

      GeneratedMethods(cn.taketoday.javapoet.ClassName className, Function<MethodName,String> methodNameGenerator)
      Create a new GeneratedMethods using the specified method name generator.
      参数:
      className - the declaring class name
      methodNameGenerator - 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 new GeneratedMethod.

      The suggestedName should provide the unqualified form of what the method does. For instance, if the method returns an instance of a given type, getInstance can 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, or is. Taking the previous example with a myBean prefix, the actual method name is getMyBeanInstance. Further processing of the method can happen to ensure uniqueness within a class.

      参数:
      suggestedName - the suggested name for the method
      method - a Consumer used to build method
      返回:
      the newly added GeneratedMethod
    • add

      public GeneratedMethod add(String[] suggestedNameParts, Consumer<cn.taketoday.javapoet.MethodSpec.Builder> method)
      Add a new GeneratedMethod.

      The suggestedNameParts should 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, or is. Taking the previous example with a myBean prefix, the actual method name is getMyBeanInstance. Further processing of the method can happen to ensure uniqueness within a class.

      参数:
      suggestedNameParts - the suggested name parts for the method
      method - a Consumer used to build method
      返回:
      the newly added GeneratedMethod
    • withPrefix

      public GeneratedMethods withPrefix(String prefix)
      Specify the prefix to use for method names. The prefix applies to suggested method names, with special handling of get, set, and is prefixes in the suggested name itself.
      参数:
      prefix - the prefix to add to suggested method names
      返回:
      a new instance with the specified prefix
    • doWithMethodSpecs

      void doWithMethodSpecs(Consumer<cn.taketoday.javapoet.MethodSpec> action)
      Call the given action with each of the MethodSpecs that have been added to this collection.
      参数:
      action - the action to perform
    • stream