Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

FINERACT-2181: Simplify toString() method in Enum classes - #4397

Merged
adamsaghy merged 1 commit into
apache:developfrom
Harsh-Srivastav123:FINERACT-2081-improve-toString-method
Mar 4, 2025
Merged

adamsaghy merged 1 commit into
apache:developfrom
Harsh-Srivastav123:FINERACT-2081-improve-toString-method

Conversation

@Harsh-Srivastav123

Copy link
Copy Markdown
Contributor

Description

The code was changed from:

return name().toString().replaceAll("_", " ");

to

return name().replace("_", " ");

Changes made:

  • Removed redundant toString() call since name() already returns a String

  • Changed replaceAll() to replace() since we're replacing a simple character, not a regex pattern

Why needed:

  • Removes unnecessary method calls

  • Improves code readability

  • More efficient since replace() is faster than replaceAll() for simple character replacement

Aligns with similar implementations in other enums like JournalEntryJsonInputParams (lines 54-56)
The change is safe and verified through accounting module tests, maintaining the same functionality with cleaner code.

Ignore if these details are present on the associated Apache Fineract JIRA ticket.

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per https://github.com/apache/fineract/#pull-requests

  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.

  • Create/update unit or integration tests for verifying the changes made.

  • Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.

  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes

  • Submission is not a "code dump". (Large changes can be made "in repository" via a branch. Ask on the developer mailing list for guidance, if required.)

FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.

…/jira/browse/FINERACT-2081).

The `toString()` method in several Enum classes has been simplified. The previous implementation:
@IOhacker

IOhacker commented Mar 3, 2025

Copy link
Copy Markdown
Contributor

LGTM

@adamsaghy

Copy link
Copy Markdown
Contributor

@Harsh-Srivastav123 FINERACT-2081 was a story to cover minor changes in 1.11. Since this version of release process started, we cannot use this story anymore. Kindly use the https://issues.apache.org/jira/browse/FINERACT-2181 from now on for minor changes which will be part of 1.12.

@Harsh-Srivastav123 Harsh-Srivastav123 changed the title FINERACT-2081: Simplify toString() method in Enum classes FINERACT-2181: Simplify toString() method in Enum classes Mar 4, 2025
@Harsh-Srivastav123

Copy link
Copy Markdown
Contributor Author

@adamsaghy I've updated the PR as per your suggestions. Could you please review the changes?
https://issues.apache.org/jira/browse/FINERACT-2181

@adamsaghy adamsaghy closed this Mar 4, 2025
@adamsaghy adamsaghy reopened this Mar 4, 2025
@adamsaghy
adamsaghy merged commit 86832c9 into apache:develop Mar 4, 2025
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.

3 participants