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

Improvement to support multiple generics class parameters #992

Merged
merged 2 commits into from
Aug 12, 2015

Conversation

francofabio
Copy link
Contributor

VRaptor is not able to support multiple generics class parameters.
Currently VRaptor resolves all generics parameter as the first parameter in generic array.
This pull request makes VRaptor able to support multiple generics class parameters.

@@ -90,11 +90,12 @@ private Object instantiateOrAddError(Parameters parameters, List<Message> errors
private List<Target<Object>> createTargets(ControllerMethod method) {
Method javaMethod = method.getMethod();
List<Target<Object>> targets = new ArrayList<>();
TypeExtractor typeExtractor = new TypeExtractor(method.getController().getType());
Copy link
Member

Choose a reason for hiding this comment

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

what about changing TypeExtractor to be a CDI managed bean?
so it could be specialized -- extensible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. Good idea.
What is your suggestion of the package for include this class?

Copy link
Member

Choose a reason for hiding this comment

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

This is really needed? This method is used in one place only. So I'd keep
as private method in the same class, to using kiss principle.
On Jul 6, 2015 15:39, "Rodrigo Turini" [email protected] wrote:

In
vraptor-core/src/main/java/br/com/caelum/vraptor/http/iogi/IogiParametersProvider.java
#992 (comment):

@@ -90,11 +90,12 @@ private Object instantiateOrAddError(Parameters parameters, List errors
private List<Target> createTargets(ControllerMethod method) {
Method javaMethod = method.getMethod();
List<Target> targets = new ArrayList<>();

  •   TypeExtractor typeExtractor = new TypeExtractor(method.getController().getType());
    

what about changing TypeExtractor to be a CDI managed bean?
so it could be specialized -- extensible


Reply to this email directly or view it on GitHub
https://github.com/caelum/vraptor4/pull/992/files#r33967540.

Copy link
Member

Choose a reason for hiding this comment

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

In the other hand, extracting to a class are giving us the single responsibility principle.
It's a small class, easily testable, with a well-defined purpose. That's why I'm ok with
this change. But sure, we can keep it as a private method. @francofabio it's your call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I created the TypeExtractor class, my intention was to allow this feature to be reused if there was a need.
Thinking about the opinion of @garcia-jj, it makes sense because VRaptor exists a few years ago and yet there was no need to use this feature.
Maybe have less impact on the project if we keep this feature in their own class (private method).
@Turini, What do you think?

** Sorry for my terrible english. :-/

Copy link
Member

Choose a reason for hiding this comment

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

That sounds great to me, go ahead @francofabio

@Turini
Copy link
Member

Turini commented Jul 6, 2015

I didn't test yet, but your PR looks great @francofabio. I've added some comments

…arametersProvider with generics parameter resolver
@lucascs
Copy link
Member

lucascs commented Jul 13, 2015

:shipit:

@garcia-jj
Copy link
Member

Sounds like good, but I want to do some tests in a large app I have before merge. May I?

@lucascs
Copy link
Member

lucascs commented Jul 15, 2015

sure, let us know how the tests went

@Turini
Copy link
Member

Turini commented Jul 22, 2015

ok! I'll release vr 4.2 RC3 tomorrow, without this PR for now :)

@garcia-jj
Copy link
Member

Works fine. I think this changes are ready to merge.

@Turini
Copy link
Member

Turini commented Aug 12, 2015

great! thank you again, @francofabio!

Turini added a commit that referenced this pull request Aug 12, 2015
Improvement to support multiple generics class parameters
@Turini Turini merged commit f4c7537 into caelum:master Aug 12, 2015
@francofabio
Copy link
Contributor Author

Ok! thanks.

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

Successfully merging this pull request may close these issues.

4 participants