On Mon, Apr 11, 2011 at 8:00 AM, tanteanni <tantea...@hotmail.com> wrote:
> an optimal implementation would be if the result type could be a
> generic type: A class lie this:
>
> class GeneralCallback<T> implements AsyncCallback<T>{
>      public GeneralCallback(T target){
>           ...
> }
>
>   public onSuccess(T result){
>     target = result;
> }
> }
>
> is it possible to get such an abstract callback class?

Sounds more like you would want an implementation that looked like:

class CollectionLoadingCallback<T> implements AsyncCallback<T> {
    private final Collection<T> col;
    public CollectionLoadingCallback(Collection<T> col) {
        this.col = col;
    }
    public void onSuccess(T result) {
        col.add(result);
    }
    ...
}

Of course, I'm sure you'd want another callback to actually know when
the value was received, but the general idea above would work.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to