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

Formatter for printing ReportNode #3317

Merged
merged 5 commits into from
Feb 10, 2025
Merged

Formatter for printing ReportNode #3317

merged 5 commits into from
Feb 10, 2025

Conversation

flo-dup
Copy link
Contributor

@flo-dup flo-dup commented Feb 10, 2025

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Does this PR already have an issue describing the problem?
No

What kind of change does this PR introduce?
Feature

What is the current behavior?
There's no way to do any formatting when printing a ReportNode or getting a message of a ReportNode

What is the new behavior (if this is a feature change)?

  • ReportNode::print takes a Formatter as argument
  • ReportNode::getMessage takes a Formatter as argument
    If no argument is provided, default formatting is used (typedValue -> typedValue.getValue().toString())

Does this PR introduce a breaking change or deprecate an API?

  • Yes
  • No

Signed-off-by: Florian Dupuy <[email protected]>
@flo-dup flo-dup requested a review from geofjamg February 10, 2025 09:16
@flo-dup
Copy link
Contributor Author

flo-dup commented Feb 10, 2025

To me this is not a breaking change. Interface ReportNode now has a new method but ReportNode cannot really have so far another implementation because of the strong link between interface and implementation.

Signed-off-by: Florian Dupuy <[email protected]>
* @author Florian Dupuy {@literal <florian.dupuy at rte-france.com>}
*/
@FunctionalInterface
public interface Formatter {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can name it ReportFormatter or MessageFormatter to avoid confusion with technical / JDK formatting classes ?

@flo-dup flo-dup merged commit 3198386 into main Feb 10, 2025
8 checks passed
@flo-dup flo-dup deleted the report_format_values branch February 10, 2025 14:40
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