Uploaded image for project: 'Apache Fineract'
  1. Apache Fineract
  2. FINERACT-1586

Reduce Boilerplate Code by Introducing lombok to Reduce getters/setters and Mapstruct to map REST DTO to Entity Objects

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: In Progress
    • Minor
    • Resolution: Unresolved
    • None
    • 1.11.0
    • None

    Description

      Lombok could help us to not only reduce a large amount of code, but also to fix a couple of inconsistencies in the code base:

      • getters/setters with non-standard characters (e. g. underscores)
      • getters/setters with typos

      The layered architecture of Fineract requires mapping between REST DTO classes and internal entity classes. The current code base contains various strategies to achieve this:

      • private functions
      • static functions
      • mapping classes

      All of these approaches are very manual (and error prone) and difficult to maintain. Mapstruct can help here:

      • throw errors at compile time (missing new attributes, type changes etc.)
      • one common concept (easier to understand)
      • reduce manually maintained code and replace mostly generated code

      Challenges:

      • maintain immutability (especially in DTO classes)
      • should we fluent builder pattern?
      • backwards compatibility
      • these improvements cannot be introduced as one pull request, but have to be split up at least at the “module” level (clients, loans, accounts etc.). This would result in approximately 30 pull requests; if we split up Lombok and Mapstruct then it would be 30 PRs each (=60); we would need this fine grained approach to make a transition as painless as possible
      • some classes are maybe beyond repair (e. g. Loan.java with 6000 lines of code, the smaller part getters/setters and a long list of utility/business logic functions)

      Attachments

        Issue Links

          1.
          Introduce Lombok to producttoaccountmapping module Sub-task Resolved Unassigned
          2.
          Introduce Lombok to provisioning module Sub-task Resolved Unassigned
          3.
          Introduce Lombok to rule module Sub-task Resolved Unassigned
          4.
          Introduce Lombok to adhocquery module Sub-task Resolved Unassigned
          5.
          Introduce Lombok to batch module Sub-task Resolved Unassigned
          6.
          Introduce Lombok to cob module Sub-task Resolved Unassigned
          7.
          Introduce Lombok to commands module Sub-task Resolved Unassigned
          8.
          Introduce Lombok to infrastructure module Sub-task Closed Unassigned
          9.
          Introduce Lombok to interoperation module Sub-task Resolved Unassigned
          10.
          Introduce Lombok to mix module Sub-task Resolved Unassigned
          11.
          Introduce Lombok to notification module Sub-task Resolved Unassigned
          12.
          Introduce Lombok to JournalEntry module Sub-task Resolved Unassigned
          13.
          Introduce Lombok to GLAccount module Sub-task Resolved Unassigned
          14.
          Introduce Lombok to accountnumberformat module Sub-task Resolved Unassigned
          15.
          Introduce Lombok to closure module Sub-task Resolved Unassigned
          16.
          Introduce Lombok to financialactivityaccount module Sub-task Resolved Unassigned
          17.
          Introduce Lombok to bulkimport module Sub-task Resolved Unassigned
          18.
          Introduce Lombok to businessdate module Sub-task Resolved Unassigned
          19.
          Introduce Lombok to cache module Sub-task Resolved Unassigned
          20.
          Introduce Lombok to emailcampaigns module Sub-task Resolved Unassigned
          21.
          Introduce Lombok to smscampaigns module Sub-task Resolved Unassigned
          22.
          Introduce Lombok to codes module Sub-task Resolved Unassigned
          23.
          Introduce Lombok to configuration module Sub-task Resolved Unassigned
          24.
          Introduce Lombok to core module Sub-task Resolved Unassigned
          25.
          Introduce Lombok to creditbureau module Sub-task Resolved Unassigned
          26.
          Introduce Lombok to dataqueries module Sub-task Resolved Unassigned
          27.
          Introduce Lombok to documentmanagement module Sub-task Resolved Unassigned
          28.
          Introduce Lombok to entityaccess module Sub-task Resolved Unassigned
          29.
          Introduce Lombok to gcm module Sub-task Resolved Unassigned
          30.
          Introduce Lombok to hooks module Sub-task Resolved Unassigned
          31.
          Introduce Lombok to jobs module Sub-task Resolved Unassigned
          32.
          Introduce Lombok to reportmailingjob module Sub-task Resolved Unassigned
          33.
          Introduce Lombok to security module Sub-task Resolved Unassigned
          34.
          Introduce Lombok to sms module Sub-task Resolved Unassigned
          35.
          Introduce Lombok to survey module Sub-task Resolved Unassigned
          36.
          Introduce Lombok to holiday module Sub-task Resolved Unassigned
          37.
          Introduce Lombok to monetary module Sub-task Resolved Unassigned
          38.
          Introduce Lombok to office module Sub-task Resolved Unassigned
          39.
          Introduce Lombok to provisioning module Sub-task Resolved Unassigned
          40.
          Introduce Lombok to staff module Sub-task Resolved Unassigned
          41.
          Introduce Lombok to teller module Sub-task Resolved Unassigned
          42.
          Introduce Lombok to workingdays module Sub-task Resolved Unassigned
          43.
          Introduce Lombok to savings module Sub-task Open Unassigned
          44.
          Introduce Lombok to the Core module (infrastructure/dataqueries) Sub-task Open Unassigned
          45.
          Introduce Lombok to the loanproduct module Sub-task Open Unassigned
          46.
          Introduce Lombok to portfolio module Sub-task Open Unassigned

          Activity

            People

              Unassigned Unassigned
              rahul.usit12 Rahul Goel
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: