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

DBManager: getAll now accepts DBFilter<T>... #290

Merged
merged 1 commit into from
Nov 8, 2023

Conversation

jrfinc
Copy link
Contributor

@jrfinc jrfinc commented Nov 7, 2023

No description provided.

@jrfinc jrfinc requested a review from ar November 7, 2023 23:02
Comment on lines +84 to +86
return this.getAll(offset, limit, orders, null);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice PR @jrfinc, do we need this overload? And the corresponding null check in the other getAll?

Without this overload a call to getAll(offset, limit, orders) will just invoke the other with an empty array.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right and we don't need it, but if removed it could break other DBManager implementations (in jPOS-EE RevisionManager for example, but could have overrides in other projects). It's an easy fix on the managers but still I thought it didn't hurt leaving it.

Regarding the null check, we need it for: Arrays.stream(filters) (I can either check for null like I did, or use Optionals. etc).

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand, I see there are two null checks, one for protecting against the nullity of the filters argument, and one for each element on it. I wonder if that is because of this call or for protection against other calls.

I was thinking that this call could be with an empty array, in case the inner null check is because of this null, but one can't be too cautious anyway right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I am thinking mainly on use cases of optional filters for a big list. It could happen that nulls get there.
I guess the devs using this call could (should?) sanitize the array and remove nulls beforehand, but it was easy to do here too.

@ar ar merged commit b8728ad into master Nov 8, 2023
10 of 14 checks passed
@jrfinc jrfinc deleted the feature/dbmgr-getall-filters branch February 29, 2024 16:19
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