Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some component definitions #261

Merged
merged 3 commits into from
Feb 23, 2025
Merged

Conversation

backpaper0
Copy link
Member

@backpaper0 backpaper0 commented Jan 22, 2025

Overview

Add component definitions for the following four classes returned by Config:

  • DuplicateColumnHandler
  • ScriptFileLoader
  • SqlBuilderSettings
  • StatisticManager

Default Components

  • DuplicateColumnHandler
    • Set ConfigSupport.defaultDuplicateColumnHandler as the default component.
  • ScriptFileLoader
    • Implement a concrete class that resolves resources using Spring's ResourceLoader and set it as the default component.
  • SqlBuilderSettings
    • Provide a custom implementation class that behaves as follows:
      • shouldRemoveBlockComment method
        • Use the Predicate<String> defined as a component named shouldRemoveBlockComment, if available.
        • Otherwise, return false.
      • shouldRemoveLineComment method
        • Use the Predicate<String> defined as a component named shouldRemoveLineComment, if available.
        • Otherwise, return false.
      • shouldRemoveBlankLines method
        • Return the value of the doma.sql-builder-settings.should-remove-blank-lines property.
      • shouldRequireInListPadding method
        • Return the value of the doma.sql-builder-settings.should-require-in-list-padding property.
  • StatisticManager
    • Set DefaultStatisticManager as the default component. Pass the value of the doma.statistic-manager.enabled property to the constructor.

These can be overridden by the user by defining components.

Properties

  • doma.sql-builder-settings.should-remove-blank-lines : boolean
    • The value returned by SqlBuilderSettings.shouldRemoveBlankLines().
  • doma.sql-builder-settings.should-require-in-list-padding : boolean
    • The value returned by SqlBuilderSettings.shouldRequireInListPadding().
  • doma.throw-exception-if-duplicate-column : boolean
    • If true, ThrowingDuplicateColumnHandler is used as the implementation class of DuplicateColumnHandler.
  • doma.statistic-manager.enabled : bool
    • If set to true, constructs a DefaultStatisticManager with enabled set to true.

Future Plans

We will integrate with Micrometer to send the statistical data collected by StatisticManager.
Since this requires the committers to have an in-depth understanding of Micrometer and StatisticManager, it may take some time to implement.

@backpaper0 backpaper0 marked this pull request as ready for review February 23, 2025 08:40
Copy link
Member

@nakamura-to nakamura-to left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Thank you!

@backpaper0 backpaper0 merged commit 680e5fd into master Feb 23, 2025
6 checks passed
@backpaper0 backpaper0 deleted the add_some_component_definitions branch February 23, 2025 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants