On Mon, Jun 22, 2009 at 7:33 PM, Ian Petersen<ispet...@gmail.com> wrote:
> Here's what I mean:
>
>   // ... surrounding code ...
>   GWT.runAsync(new AsyncCallback() {
>     public void onFailure(Throwable caught) {
>       // deal with failure
>     }
>
>     @SplitPointName("I like Bruce's idea")
>     public void onSuccess() {
>       // deal with success
>     }
>   });
>   // ... surrounding code ...
>
> I'm not sure if it's better or worse, but it seems more flexible than
> requiring a surrounding method.

Okay, call it proposal 5, annotation of onSuccess methods.

I'm not clear on how we should associate onSuccess methods with
runAsync calls in the general case.  Note that the argument to
runAsync doesn't currently have to be an anonymous inner class:

class Bakery {
  private static class CakeMaker implements RunAsyncCallback {...}
  public static void makeOrder(CakeType cake) {
    GWT.runAsync(new CakeMaker(cake));
  }
}

It gets even more interesting if the CakeMaker type is abstract, and
the implementation is made by a builder class.  The builder might even
have multiple implementations:

class Bakery {
  private static abstract class CakeMaker implements RunAsyncCallback { }
  private static class CakeMakerBuilder {
    ...
    public CakeMaker build() {
      class CakeMakerImpl1 extends CakeMaker {
        public void onSuccess() { ... }
      }
      class CakeMakerImpl1() {
        public void onSuccess() { ... }
      }
      if (someConfigProperty) { return new CakeMakerImpl1(); } else {
return new CakeMakerImpl2() }
    }
  }
}


Which onSuccess method(s) should be annotated, and how should GWT
interpret those annotations?


Lex Spoon

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to