refactor: delegate format-specific logic to per-format exporters#204
Conversation
|
Walkthrough
ChangesFormat exporter refactor
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/java/com/flowingcode/vaadin/addons/gridexporter/GridExporter.java (1)
1144-1190: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUnused
buttonparameter flagged by static analysis is intentional (template method), but worth suppressing explicitly.
createFooterDownloadHandler(Component button)'s default implementation inFormatExporterdoesn't usebutton— it's only consumed by theConcurrentFormatExporteroverride viaforComponent(button). This is a legitimate template-method pattern (CSV correctly doesn't need it), so the Sonar warning is a false positive rather than a real defect. Consider a@SuppressWarningsannotation or a brief comment to make the intent explicit and silence the recurring finding.Suggested annotation
+ `@SuppressWarnings`("java:S1172") // button is used by ConcurrentFormatExporter overrides DownloadHandler createFooterDownloadHandler(Component button) { return getDownloadHandler(getConfiguredTemplate()); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/com/flowingcode/vaadin/addons/gridexporter/GridExporter.java` around lines 1144 - 1190, Add an explicit suppression or concise explanatory comment to FormatExporter.createFooterDownloadHandler(Component button) documenting that the unused parameter is intentional for the template-method contract and is consumed by ConcurrentFormatExporter overrides. Keep the default implementation behavior unchanged.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/main/java/com/flowingcode/vaadin/addons/gridexporter/GridExporter.java`:
- Around line 1144-1190: Add an explicit suppression or concise explanatory
comment to FormatExporter.createFooterDownloadHandler(Component button)
documenting that the unused parameter is intentional for the template-method
contract and is consumed by ConcurrentFormatExporter overrides. Keep the default
implementation behavior unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 20892c9e-75cd-46b5-8e76-382257e198e5
📒 Files selected for processing (1)
src/main/java/com/flowingcode/vaadin/addons/gridexporter/GridExporter.java



Close #171
Internal refactor (public API is unchanged).
Behaviour I deliberately preserved
The excelCustomTemplate / docxCustomTemplate values from createFor(grid, excel, docx) are now stored as fields (they were previously captured only in the listener closure) so the format exporters can supply them for the footer buttons.
Summary by CodeRabbit
Refactor
Bug Fixes