-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Numerous updates to conversion service #132
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
Conversation
Refactor internal workings of GenericConversionService in order to better support future enhancements. This commit should not affect existing behavior. Issue: SPR-9927
Introduce new ConditionalConversion interface that can be applied to Converter, ConverterFactory or GenericConverter interfaces to make them conditional. Prior to this commit the only ConditionalGenericConverter could be conditional. Issue: SPR-9928
Prior to this commit conversion between like types would often result in a copy of the object. This can be problematic in the case of large byte arrays and objects that do not have a default constructor. The ConversionService SPI now includes canBypassConvert methods that can be used to deduce when conversion is not needed. Several existing converters have been updated to ensure they only apply when source and target types differ. This change introduces new methods to the ConversionService that will break existing implementations. However, it anticipated that most users are consuming the ConversionService interface rather then extending it. Issue: SPR-9566
Issue: SPR-9566
@cbeams This commit has now been reworked following the review comments in: Specifically:
I have removed ExpectedException for now, we can return to this later
TypeDescriptor is no longer final
This is mainly due to the fact that both issues touch the same areas of code so create atomic pull requests is hard. This pull request still deals with a number of issues but now the commits are much more logically organized. I have tried to order them in terms of how controversial they are so that you can work from the bottom up
Neither should be backported IMHO. I have removed 3.1.3 from the fixVersion field
I spoke to @jhoeller about why the search changed from 3.0 to 3.1, he recalled that there was a good reason but not exactly what it was. The new algorithm does not fundamentally change the way that the type hierarchy is searched, it just considers java. and javax. packages after other packages (see the updated commit message). Thanks for the review, it was very helpful! |
EnumToStringConverter in now conditional and only matches Enums that do not implement interfaces that can be converted. Issue: SPR-9692
Thanks, Phil, this is now merged into SpringSource/master. |
Changes are primarily to support conversion of enums with interfaces and to allow performance optimization when converting byte arrays.
See individual commits for details
Issues: SPR-9566, SPR-9692, SPR-9927, SPR-9928