-
Notifications
You must be signed in to change notification settings - Fork 53
Convert refining #125
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
Convert refining #125
Conversation
The AbstractConverter class was leaving a lot of methods unimplemented. Typically, most of these can be chained together. The AbstractConverter now implements all but one convert and canConvert signature.
|
Thanks @hinerm! I made some comments. Please address as time allows. One other thing to consider would be deprecating the |
Removed unnecessary implementations for dummy classes, as these methods are now taken care of in the abstract layer.
Adds a new Converter type to handle null source or destination types. Without this converter, the null logic was managed in a mix between AbstractConverter and DefaultConverter - which means that all converters had some null logic in them (potentially wrong for that given converter) and could not run before DefaultConverter, without copying its null logic.
Ensure the null converter is behaving as intended.
Refactors AbstractConverter and DefaultConverter to take into account the new NullConverter and the migration of boilerplate to AbstractConverter. Key points: * Control flow at the abstract layer attempts to preserve the Type if given, as this contains information that can be lost in a Class. * Removed several delegating method implementations from DefaultConverter
294812b to
0c7956a
Compare
|
TODO summary:
|
We would like to move away from these signatures as the process of conversion implies there is an actual source Object to convert from, which makes these signatures confusing. They should be unnecessary, and thus removed in SJC 3.0. This allows us to focus the functionality of the NullConverter, such that its canConvert signatures always return true for a null Object, and false for anything else. This requires a temporary stop-gap of restoring some null class support in the DefaultConverter, but only in deprecated methods.
Added a test for converting between primitive types.
Add a test class for individual converters. Currently only the NullConverter is tested, as testing the DefaultConverter would effectively be replicating all of the ConvertService test.
Adds more default implementations to the abstract Converter layer, simplifying the Converter implementation process. Adds a NullConverter to encapsulate null translation logic.
Improves the
Converterframework by moving more default method implementations toAbstractConverter, restructuring the delegation ofAbstractConverterto give preference to theTypeargument, and extracting thenullparameter logic to a dedicatedNullConverterwhich can run at the highest priority, so that otherConverterimplementations do not need to worry about running ahead ofDefaultConverter.