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

Specify a single general matcher for all record components #6

Open
runeflobakk opened this issue Mar 5, 2024 · 0 comments
Open

Specify a single general matcher for all record components #6

runeflobakk opened this issue Mar 5, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@runeflobakk
Copy link
Owner

Can be useful to specify some general restriction for all (or remaining) components of a record, instead of enumerating all the components with the same matcher.

Example case:

  • specify a matcher for a single value, but it is also imperative that the remaining components have not been set, i.e. they should be nullValue().

Typing

A general matcher must necessarily be typed as either fixed Matcher<Object> or the most specific type that works with all components. Say, if if you have record (Integer i, Long l) {}, a matcher for all components could be Matcher<Number>, where Number is inferred as the common type which is applicable for both Integer and Long. Ideally, this should also be inferred should the components use primitive types int and long.

@runeflobakk runeflobakk added the enhancement New feature or request label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant