Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-1240

Give Record useful equality and hash semantics

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Critical
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 1.1.0.RC1
    • Component/s: GWT
    • Labels:
      None

      Description

      Records are currently unusable as-is with Collections across requests to the server. Implement equals() and hashCode() to reflect Id / transientId internals.

      Foo returnedFoo;
      Foo newFoo = rf.create(Foo.class);
      rf.fooRequests().persistAndReturn(newFoo).fire(new Receiver<Foo>() {
      onSuccess(Foo result)

      { returnedFoo = result; assert newFoo.equals(result); }

      }

      // later
      returnedFoo = request.edit(returnedFoo);
      returnedFoo.setSomething(42);
      rf.fooRequests().persistAndReturn(returnedFoo).fire(new Reciever<Foo>() {
      onSuccess(Foo result)

      { assert newFoo != returnedFoo; assert returnedFoo != result; // Because of mutation above assert returnedFoo.equals(result); assert newFoo.equals(result); assert returnedFoo.getId() == result.getId(); assert newFoo.getId() == null; }

      }

        Attachments

          Activity

            People

            Assignee:
            amitmanjhi@google.com Amit Manjhi
            Reporter:
            rjrjr@google.com Ray Ryan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1.5d
                1.5d
                Remaining:
                Remaining Estimate - 1.5d
                1.5d
                Logged:
                Time Spent - Not Specified
                Not Specified