Class RepositoryContributor
java.lang.Object
org.springframework.data.repository.aot.generate.RepositoryContributor
Contributor for AOT repository fragments.
- Since:
- 4.0
- Author:
- Christoph Strobl, Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionRepositoryContributor(AotRepositoryContext repositoryContext) Create a newRepositoryContributorfor the givenAotRepositoryContext. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidcontribute(GenerationContext generationContext) Contribute the AOT repository fragment to the givenGenerationContext.protected @Nullable MethodContributor<? extends QueryMethod> contributeQueryMethod(Method method) Customization hook for store implementations to contribute a query method.protected ProjectionFactoryprotected voidcustomizeClass(AotRepositoryClassBuilder builder) Customization hook for store implementations to customize class after building the entire class.protected voidCustomization hook for store implementations to customize the fragment constructor after building the constructor.static StringformatTraceMessage(String title, String label, String content) Format a trace message with a title, label, and content using ascii art style borders.protected ProjectionFactoryprotected RepositoryInformationstatic StringprefixWithLineNumbers(String contents) Format the given contents by prefixing each line with its line number in a block comment.
-
Constructor Details
-
RepositoryContributor
Create a newRepositoryContributorfor the givenAotRepositoryContext.- Parameters:
repositoryContext- context providing details about the repository to be generated.
-
-
Method Details
-
createProjectionFactory
- Returns:
- a new
ProjectionFactoryto be used with the AOT repository builder. The actual instance should be accessed throughgetProjectionFactory().
-
getProjectionFactory
- Returns:
- the used
ProjectionFactory.
-
getRepositoryInformation
- Returns:
- the used
RepositoryInformation.
-
contribute
Contribute the AOT repository fragment to the givenGenerationContext. This method will prepare the metadata, generate the source code and write it to theGenerationContext.- Parameters:
generationContext- must not be null.
-
formatTraceMessage
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
-
customizeClass
Customization hook for store implementations to customize class after building the entire class. -
customizeConstructor
Customization hook for store implementations to customize the fragment constructor after building the constructor. -
contributeQueryMethod
Customization hook for store implementations to contribute a query method.
-