-
Notifications
You must be signed in to change notification settings - Fork 54
Converters #158
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
Converters #158
Conversation
|
This is potentially ready to merge. All of the converters' junit tests are now running and passing. |
|
@awalter17 are there plans to implement converters from e.g. int[] to long[], short[] to long[], float[] to double[] etc? |
The only viable general solution is to be recursive. The plan is to split out the collections logic of the This will be part of #109. See #109 (comment) |
|
Actually, couldn't I just write an adapter from e.g. |
|
@dietzc You could write such adapters, but you would need many of them. And they wouldn't handle e.g. |
|
After testing this PR a bit it looks like it needs some more work. Since all of the new converters are the same priority as the DefaultConverter, they are not actually picked, and thus are not being tested when going through the Also, it seems like true primitive types (e.g. 'int', 'float') are not actually supported. We should not have dedicated converters for these, but ensure the getNonprimitiveClass method is being used in the A simple groovy script demonstrating these problems: If the functionality is stripped out of |
|
Indeed, removing primitive conversion from the
Why not? Would be good to ensure behavior doesn't break in the future. I would prefer a unit test of it. |
|
@ctrueden OK so my original tests were flawed because it was testing
I meant that we may not want the unit tests to rely on particular concrete classes coming back as handlers, but we do want to verify the convert service can handle primitive conversions. Or at least these tests shouldn't be conflated (i.e. I think a test for for |
|
OK I just added 2 commits that allow the new primitive converters to handle unboxed primitive conversion requests. Currently they still are not because of their priority relative to the |
|
Just want to point out a use case where having the |
This also narrows the return types as appropriate for each concrete type.
They are redundant with the new more granular test classes.
In the AbstractConverter we should ensure that nonprimitive types are always returned for input/output classes.
Writing "FIRST_PRIORITY - 1" is the same as "FIRST_PRIORITY", since that constant equals Double.POSITIVE_INFINITY.
|
Rebased over latest master, and all tests pass. So let's merge this long overdue branch. |
This is not ready to merge, because the junit tests are not running due to nested test classes.