Uploaded image for project: 'MRUnit'
  1. MRUnit
  2. MRUNIT-125

reduce duplicate code related to fluent methods with generics

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.0.0
    • None

    Description

      There is a lot of duplicate code in order to provide fluent style with methods. We could reduce the duplicate code with generics by adding an unbound type parameter T to TestDriver and then all the fluent methods could go in TestDriver but return type T. The base classes, MapDriverBase etc, would just pass the T on so you would have:

      public abstract class TestDriver<K1, V1, K2, V2, T>
      public abstract class MapDriverBase<K1, V1, K2, V2, T> extends TestDriver<K1, V1, K2, V2, T>
      public class MapDriver<K1, V1, K2, V2> extends MapDriverBase<K1, V1, K2, V2, MapDriver<K1, V1, K2, V2>>

      Attachments

        1. mrunit-125-spoiler.diff
          59 kB
          Bertrand Dechoux
        2. mrunit-125-patch.diff
          59 kB
          Bertrand Dechoux
        3. mrunit-125-2.diff
          32 kB
          Bertrand Dechoux
        4. mrunit-125.diff
          47 kB
          Bertrand Dechoux

        Activity

          People

            bdechoux Bertrand Dechoux
            jdonofrio Jim Donofrio
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: