create *final* variable in the enclosing block

cheers
  JZ

On Wed, Jun 16, 2010 at 1:09 PM, Magnus <[email protected]>wrote:

> Hi,
>
> because I cannot access a variable in the enclosing block from within
> an AsyncCallback method I found the following workaround with a class
> global variable, which I find very unpretty. How can one do this
> better?
>
> String tmp_str_usr = "";
>
>  String getUser ()
>  {
>  SystemServiceAsync svc = GWT.create (SystemService.class);
>
>  svc.getUsr
>  (
>   new AsyncCallback<String>()
>   {
>    public void onFailure(Throwable caught)
>    {
>     Window.alert("server side failure: " + caught);
>    }
>
>    public void onSuccess(String usr)
>    {
>     tmp_str_usr = usr;
>    }
>   }
>  );
>
>  return (tmp_str_usr);
>  }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

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

Reply via email to