What is the IoC / "Springy" way to handle MVP in GWT? (Hint, probably not the Spring Roo 1.1 way)

Posted by Ehrann Mehdan on Stack Overflow See other posts from Stack Overflow or by Ehrann Mehdan
Published on 2010-12-30T10:45:55Z Indexed on 2010/12/30 10:54 UTC
Read the original article Hit count: 269

This is the Spring Roo 1.1 way of doing a factory that returns a GWT Activity (Yes, Spring Framework)

 public Activity getActivity(ProxyPlace place) {
    switch (place.getOperation()) {
      case DETAILS:
        return new EmployeeDetailsActivity((EntityProxyId<EmployeeProxy>)place.getProxyId(), requests, 
          placeController, ScaffoldApp.isMobile() ? EmployeeMobileDetailsView.instance() : EmployeeDetailsView.instance());

      case EDIT:
        return makeEditActivity(place);

      case CREATE:
        return makeCreateActivity();
    }

    throw new IllegalArgumentException("Unknown operation "
        + place.getOperation());
  }

It seems to me that we just went back hundred of years if we use a switch case with constants to make a factory. Now this is official auto generated Spring roo 1.1 with GWT / GAE integration, I kid you not

I can only assume this is some executives empty announcements because this is definitly not Spring

It seems VMWare and Google were too fast to get something out and didn't quite finish it, isn't it?

Am I missing something or this is half baked and by far not the way Spring + GWT MVP should work?

Do you have a better example of how Spring, GWT (2.1 MVP approach) and GAE should connect? I would hate to do all the plumbing of managing history and activities like this. (no annotations? IOC?)

I also would hate to reinvent the wheel and write my own Spring enhancement just to find someone else did the same, or worse, find out that SpringSource and Google will release roo 1.2 soon and make it right

© Stack Overflow or respective owner

Related posts about gwt

Related posts about inversion-of-control