Spring Framework
  1. Spring Framework
  2. SPR-5794

Composing synthetic converters from concrete converters

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0 RC3
    • Fix Version/s: Waiting for Triage
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      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

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              Keith Donald
              Reporter:
              Oleg Zhurakousky
              Last updater:
              Chris Beams
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since last comment:
                4 years, 47 weeks, 2 days ago