Class MethodNameGenerator

java.lang.Object
org.springframework.aot.generate.MethodNameGenerator

public class MethodNameGenerator extends Object
Generates unique method names that can be used in ahead-of-time generated source code. This class is stateful so one instance should be used per generated type.
Since:
6.0
Author:
Phillip Webb
  • Constructor Details

    • MethodNameGenerator

      public MethodNameGenerator()
      Create a new MethodNameGenerator instance without any reserved names.
    • MethodNameGenerator

      public MethodNameGenerator(String... reservedNames)
      Create a new MethodNameGenerator instance with the specified reserved names.
      Parameters:
      reservedNames - the method names to reserve
    • MethodNameGenerator

      public MethodNameGenerator(Iterable<String> reservedNames)
      Create a new MethodNameGenerator instance with the specified reserved names.
      Parameters:
      reservedNames - the method names to reserve
  • Method Details

    • generateMethodName

      public String generateMethodName(Object... parts)
      Generate a new method name from the given parts.
      Parameters:
      parts - the parts used to build the name.
      Returns:
      the generated method name
    • join

      public static String join(Object... parts)
      Join the specified parts to create a valid camel case method name.
      Parameters:
      parts - the parts to join
      Returns:
      a method name from the joined parts.