Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-5794

Composing synthetic converters from concrete converters


    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 3.0 RC3
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
    • Last commented by a User:


      Here is the summary of the design as well as the list of core features
      I am proposing with this implementation: (Patches are attached)

      • Similar to the DefaultTypeConverter I've implemented
        ComposingConverterService which extends GenericTypeConverter
      • ComposingConverterService provides all the functionality of the
        DefaultTypeConverter as well as ability (as it is also implementation
        of the ConverterRegistry) to have synthetic Converters composed from
        the set of concrete Converters. For example: Providing two concrete
        converters AtoB and BtoC the resulting converter map will actually
        have 3 converters AtoB, BtoC and AtoC (synthetic converter composed
        from sequential chain of AtoB and BtoC)
      • Prevents the creation of circular synthetic converters. For example:
        Having AtoB BtoC and CtoA could result in the creation of synthetic
        converter AtoA (via AtoB->BtoC->CtoA). Special hook is implemented to
        prevent this from happening and test was created to verify it.
      • Calculation of the most optimal routes for composition of the
        synthetic converters. For example: Let's say you have AtoB, BtoC, CtoD
        and BtoD concrete converters. This could result in two strategies for
        synthetic converter AtoD. One strategy would be composed via (AtoB,
        BtoC, CtoD) while another strategy would use different and more
        optimal route (AtoB and BtoD). Special hook is implemented to pick the
        latest conversion strategy as the most optimal one. Also, these
        conversion routes are recalculated and optimized in real time as new
        concrete converters are registered and could result in potential for
        more optimal route. Appropriate test cases were created to verify it.
      • Synthetic converters are created during initialization of the
        Converter service so during the usage phase no search and/or
        calculation is needed to find the appropriate conversion strategy as
        it is implemented in other frameworks (e.g., Tapestry) which i believe will affect (in a good
        way) a performance and quality of the conversion routines.
      • and other minor features

      I have tested this service vs all the existing test cases as well as created
      an additional test case and had a green bar across the screen.

      1. ComposingConverterService.txt
        11 kB
        Oleg Zhurakousky
      2. ComposingConverterService.txt
        11 kB
        Oleg Zhurakousky
      3. ComposingConverterServiceTest.txt
        11 kB
        Oleg Zhurakousky
      4. ConversionPlan.txt
        10 kB
        Oleg Zhurakousky
      5. ConversionPLanDefinition.txt
        2 kB
        Oleg Zhurakousky

        Issue Links


          juergen.hoeller Juergen Hoeller added a comment -

          Closing groups of outdated issues. Please reopen if still relevant.

          juergen.hoeller Juergen Hoeller added a comment - Closing groups of outdated issues. Please reopen if still relevant.


            • Assignee:
              juergen.hoeller Juergen Hoeller
              oleg.zhurakousky@springsource.com Oleg Zhurakousky
              Last updater:
              Juergen Hoeller
            • Votes:
              1 Vote for this issue
              4 Start watching this issue


              • Created:
                Days since last comment:
                2 years, 3 days ago