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

Bad API for instance methods

    XMLWordPrintable

    Details

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

      Description

      We've realized that the convention for firing instance methods is leaving a lot of corner cases for bugs we're going to have to fix. The fact that one creates new proxies off of RF rather than a request object, besides being confusing, is easy to misuse.

      For example:

      Person p = rf.create(Person.class);
      Request<Void> r1 = rf.persist(p);
      Request<Void> r2 = rf.persist(p);
      r1.fire(...);
      r2.fire(...);

      // later

      rf.find(p); // Which new instance will be returned?

      The fix is actually very simple. It requires no change to the wire format, and very little change to RequestFactoryGenerator and the servlet.

      We move the create(Class<P>) from RequestFactory to Request, and introduce a new interface:

      InterfaceRequest<T, P extends EntityProxy> extends Request<R, T> {
      /**

      • Set the entity that will receive this request.
        */
        InterfaceRequest <T, P> to(P instance);

      /**

      • Extends fire to throw an exception if it is called without to()
        */
        void fire(Receiver<T> r);
        }

      This has the nice side effect of fixing ROO-1216. Might as well fix ROO-1293 at the same time.

        Attachments

          Activity

            People

            Assignee:
            bobv Robert Vawter
            Reporter:
            rjrjr@google.com Ray Ryan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

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