Skip to content

Conversation

@weihubeats
Copy link
Member

@weihubeats weihubeats commented Jul 31, 2025

Purpose of the pull request

#453

What's changed?

reduce duplicate code

Checklist

  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

@delei
Copy link
Member

delei commented Jul 31, 2025

Hi, @weihubeats
Thank you for submitting this PR!

Please modify the commit message to better comply with the commit guidelines.The same applies to other PRs you have submitted.
e.g., refactor: xxx or improvement: xxx

@weihubeats weihubeats changed the title reduce duplicate code refactor: FastExcelFactory Jul 31, 2025
@weihubeats
Copy link
Member Author

I've updated the PR title to comply with PR submission guidelines.

@delei
Copy link
Member

delei commented Jul 31, 2025

I've updated the PR title to comply with PR submission guidelines.

We also recommend modifying the other PRs you submitted.

@weihubeats
Copy link
Member Author

ok

Copy link
Member

@psxjoy psxjoy left a comment

Choose a reason for hiding this comment

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

LGTM.
If no one has other questions,I will merge this PR in 24h.

@psxjoy psxjoy added the PR: development completed Development completed, waiting for release label Jul 31, 2025
Copy link
Member

@alaahong alaahong left a comment

Choose a reason for hiding this comment

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

Seems no any unit test with given changes?

@psxjoy
Copy link
Member

psxjoy commented Aug 5, 2025

Please add unit tests.

@psxjoy psxjoy requested a review from Copilot August 7, 2025 11:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the FastExcelFactory class to reduce code duplication by introducing new conditional setter methods (*IfNotNull) across builder classes. The purpose is to eliminate repetitive null-checking patterns and simplify method implementations.

Key Changes:

  • Introduced *IfNotNull methods in builder classes to conditionally set values only when non-null
  • Simplified FastExcelFactory methods by replacing verbose null-checking patterns with fluent method chaining
  • Updated one method to delegate to another for consistency

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
FastExcelFactory.java Refactored factory methods to use new conditional setter methods, eliminating repetitive null checks
ExcelWriterTableBuilder.java Added tableNoIfNotNull method for conditional table number setting
ExcelWriterSheetBuilder.java Added sheetNoIfNotNull and sheetNameIfNotNull methods for conditional setting
ExcelReaderSheetBuilder.java Added sheetNoIfNotNull, sheetNameIfNotNull, and numRowsIfNotNull methods
AbstractExcelReaderParameterBuilder.java Added registerReadListenerIfNotNull method for conditional listener registration
AbstractParameterBuilder.java Added headIfNotNull method for conditional head class setting

@weihubeats
Copy link
Member Author

Test cases have now been added

@psxjoy psxjoy merged commit 97f4e8a into apache:main Aug 22, 2025
5 checks passed
@delei delei added this to the 1.3.0 milestone Aug 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: development completed Development completed, waiting for release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants