Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-351 Refactor some new components introduced for replication
  3. KAFKA-354

Refactor getter and setter API to conform to the new convention

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 0.8.0
    • None
    • None

    Description

      We just agreed on a new convention for getter/setter APIs. It will be good to refactor code to conform to that.

      > We can actually go with public vals or vars - there is not much point in
      > defining a custom getter/setter as that is redundant.
      >
      > For example:
      > - start with "val x"
      > - over time, we determine that it needs to be mutable - change it to "var
      > x"
      > - if you need something more custom (e.g., enforce constraints on the
      > values that you can assign) then we can add the custom setter
      > private[this] var underyling: T = ...
      > def x = underlying
      > def x_=(update: T) { if (constraint satisfied)

      {underlying = update}

      > else

      {throw new Exception}

      }
      >
      > All of the above changes will be binary compatible since under the covers,
      > reads/assignments are all through getter/setter methods.

      Attachments

        Activity

          People

            charmalloc Joe Stein
            nehanarkhede Neha Narkhede
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: