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

Implement @RegisterCollector #2357

Closed
wants to merge 3 commits into from
Closed

Implement @RegisterCollector #2357

wants to merge 3 commits into from

Conversation

TheRealRyGuy
Copy link
Contributor

Adds an annotation call to JdbiCollectors#registerCollector(Type, Collector), allowing for QoL complex collectors as an alternative to making a CollectorFactory for use in interface DAOs.
This could probably use some tests though

@hgschmie
Copy link
Contributor

Hi @TheRealRyGuy,

Thank you for opening a PR with the Jdbi project. This seems a useful addition to our code base. As you pointed out, it would be good to have some tests (and also add some documentation). I will see if I can address this later this week.

@sonarcloud
Copy link

sonarcloud bot commented May 16, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@stevenschlansker stevenschlansker left a comment

Choose a reason for hiding this comment

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

Thank you for this - I agree, we should have a test case.


try {
Type type = null; //resultant type
for(Type t : registerCollector.value().getGenericInterfaces()) {
Copy link
Member

Choose a reason for hiding this comment

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

This looks like it could be something along the lines of GenericTypes.findGenericParameter(registerCollector.value(), Collector.class).orElseThrow(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This calls Class#getGenericSuperclass instead of Class#getGenericInterfaces, not applicable as far as I know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants