Skip to content

#59 extract field helper in RtTransaction - #129

Merged
yegor256 merged 1 commit into
zold-io:masterfrom
edmoffo:59-rttransaction-field-helper
Jun 14, 2026
Merged

yegor256 merged 1 commit into
zold-io:masterfrom
edmoffo:59-rttransaction-field-helper

Conversation

@edmoffo

@edmoffo edmoffo commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

The seven field accessors in RtTransaction (id, time, amount, prefix, bnf, details, signature) each contained an inline copy of the same six-line split-and-pick block that wrapped ItemAt and Split in IoChecked and UncheckedText. This change extracts that block into a single private field(int) helper and rewrites the seven call sites to use it. The class also gains @SuppressWarnings("PMD.TooManyMethods") because adding the helper pushes the method count past the PMD threshold; the existing class was already at the limit before the refactor.

No public behavior changes. The 35 tests in RtTransactionTest still pass against the new implementation, and the full qulice pass runs clean.

Checks run locally on this branch: mvn --batch-mode -Pqulice clean install — BUILD SUCCESS; 68 tests run, 0 failures, 0 errors, 5 skipped (skip set unchanged from master).

Closes #59

Replace seven inline copies of the split-and-pick block with a
single private field(int) helper that returns the raw value at
the given index of the semicolon-separated transaction string.

@bibonix bibonix left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving. Pure extraction of seven duplicated split-and-pick blocks into one private field(int) helper with no behavior change. The seven-field guard in the constructor keeps ItemAt safe for indices 0 through 6. Existing tests cover every public accessor and CI is green across the matrix. No inline comments.

@yegor256
yegor256 merged commit 09d6b6e into zold-io:master Jun 14, 2026
11 checks passed
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.

Code duplication in RtTransaction

3 participants