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

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

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            rahul.usit12 Rahul Goel

            Dates

              Created:
              Updated:

              Slack

                Issue deployment