Skip to content

Adds ifFilled utility method to Strings#618

Merged
idlira merged 1 commit into
mainfrom
ili/OX-12357
Jun 24, 2026
Merged

Adds ifFilled utility method to Strings#618
idlira merged 1 commit into
mainfrom
ili/OX-12357

Conversation

@idlira

@idlira idlira commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Additional Notes

  • This PR fixes or works on following ticket(s): OX-12357

Checklist

  • Code change has been tested and works locally
  • Code was formatted via IntelliJ and follows SonarLint & best practices
  • Patch Tasks: Is local execution of Patch Tasks necessary? If so, please also mark the PR with the tag.

Provides a convenient way to execute a consumer if the string representation of an object is non-empty. Includes comprehensive test coverage.

Fixes: OX-12357
@idlira idlira added 🧬 Enhancement Contains new features 👶🏻 Trivial Easy to review labels Jun 24, 2026
@idlira
idlira requested a review from Copilot June 24, 2026 07:20

Copilot AI 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.

Pull request overview

Adds a small utility to Strings to execute a callback only when an input value is considered “filled” (non-null and non-empty via toString()), with accompanying unit tests to validate the new behavior.

Changes:

  • Added Strings.ifFilled(@Nullable Object, Consumer<String>) helper.
  • Added Kotlin tests covering ifFilled behavior for filled/empty/null values.

Reviewed changes

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

File Description
src/main/java/sirius/kernel/commons/Strings.java Introduces the ifFilled utility method using isFilled to guard callback execution.
src/test/kotlin/sirius/kernel/commons/StringsTest.kt Adds unit tests for the new Strings.ifFilled method across several input types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/sirius/kernel/commons/Strings.java
@idlira
idlira merged commit a87343d into main Jun 24, 2026
7 checks passed
@idlira
idlira deleted the ili/OX-12357 branch June 24, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🧬 Enhancement Contains new features 👶🏻 Trivial Easy to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants