Class ClassNameGenerator

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

public final class ClassNameGenerator extends Object
Generates unique class names that can be used in ahead-of-time generated source code. This class is stateful so the same instance should be used for all name generation. Most commonly the class name generator is obtained via a GenerationContext.
Since:
6.0
Author:
Phillip Webb
See Also:
  • GeneratedClassName
  • Constructor Details

    • ClassNameGenerator

      public ClassNameGenerator()
  • Method Details

    • generateClassName

      public org.springframework.javapoet.ClassName generateClassName(Class<?> target, String featureName)
      Generate a new class name for the given target / featureName combination.
      Parameters:
      target - the target of the newly generated class
      featureName - the name of the feature that the generated class supports
      Returns:
      a unique generated class name
    • generateClassName

      public org.springframework.javapoet.ClassName generateClassName(String target, String featureName)
      Generate a new class name for the given name / featureName combination.
      Parameters:
      target - the target of the newly generated class. When possible, this should be a class name
      featureName - the name of the feature that the generated class supports
      Returns:
      a unique generated class name