Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-1239

Investigate potential usage of wither-methods for setting bean values

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Mapping / Conversion
    • Labels:
      None
    • Sprint:
      Lovelace M1, Lovelace M2 / M3, Lovelace RC1

      Description

      There are a couple of places in the framework where we need to programmatically tweak the state of an entity for technical reasons. One of them is optimistic locking where we need to initialize the version property.

      If an entity class is designed to be immutable, it's unexpected that we tweak the instance given. Assuming the class exposed explicit means to create new instances with a certain property set to a different value (e.g. withVersion(…)) we could rather use that instead of manipulating the field.

      There are two main options how to achieve this:

      1. A solution specific to versioning that invokes a wither method for the version property and the optimistic locking code overhauled to use that new API.
      2. A generic mechanism in the property access APIs that prefers withers over setters.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              olivergierke Oliver Drotbohm
              Reporter:
              olivergierke Oliver Drotbohm
              Last updater:
              Oliver Drotbohm
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: