Class RepositoryContributor

java.lang.Object
org.springframework.data.repository.aot.generate.RepositoryContributor

public class RepositoryContributor extends Object
Contributor for AOT repository fragments.
Since:
4.0
Author:
Christoph Strobl, Mark Paluch
  • Constructor Details

    • RepositoryContributor

      public RepositoryContributor(AotRepositoryContext repositoryContext)
      Create a new RepositoryContributor for the given AotRepositoryContext.
      Parameters:
      repositoryContext - context providing details about the repository to be generated.
  • Method Details

    • createProjectionFactory

      protected ProjectionFactory createProjectionFactory()
      Returns:
      a new ProjectionFactory to be used with the AOT repository builder. The actual instance should be accessed through getProjectionFactory().
    • getProjectionFactory

      protected ProjectionFactory getProjectionFactory()
      Returns:
      the used ProjectionFactory.
    • getRepositoryInformation

      protected RepositoryInformation getRepositoryInformation()
      Returns:
      the used RepositoryInformation.
    • contribute

      public final void contribute(GenerationContext generationContext)
      Contribute the AOT repository fragment to the given GenerationContext. This method will prepare the metadata, generate the source code and write it to the GenerationContext.
      Parameters:
      generationContext - must not be null.
    • formatTraceMessage

      public static String formatTraceMessage(String title, String label, String content)
      Format a trace message with a title, label, and content using ascii art style borders.
      Parameters:
      title - title of the block (e.g. "Generated Source").
      label - label that follows the title. Will be truncated if too long.
      content - the actual content to be displayed.
      Returns:
    • prefixWithLineNumbers

      public static String prefixWithLineNumbers(String contents)
      Format the given contents by prefixing each line with its line number in a block comment.
      Parameters:
      contents -
      Returns:
    • customizeClass

      protected void customizeClass(AotRepositoryClassBuilder builder)
      Customization hook for store implementations to customize class after building the entire class.
    • customizeConstructor

      protected void customizeConstructor(AotRepositoryConstructorBuilder builder)
      Customization hook for store implementations to customize the fragment constructor after building the constructor.
    • contributeQueryMethod

      protected @Nullable MethodContributor<? extends QueryMethod> contributeQueryMethod(Method method)
      Customization hook for store implementations to contribute a query method.