Hi,
That's a good question and I am curious about the proper way to handle
it. One way I came up with for handling it is this.:

class SpecializedObjectWrapper<T extends HasValue<String> &
HasBlurHandlers> extends ObjectWrapper<T>
{
        public SpecializedObjectWrapper(T v)
        {
                super(v);
        }
}

class ObjectWrapper<T>
{
        public ObjectWrapper(T value)
        {
                this.value = value;
        }

        public T getValue() { return value; }
        private T value;
};

Then use:
SpecializedObjectWrapper<?> getUsernameTextBox()

for your method.

This seems a bit bulky to me, although one can shared the
ObjectWrapper class and create a new SpecializedObjectWrapper for each
unique return type. I am interested if there is a more elegant
solutions.

On Nov 10, 12:20 pm, "P.G.Taboada" <[email protected]> wrote:
> Hi,
>
> I am running into Java compilation issues.
> Example:
>
> public class LoginPresenter {
>
>         public interface Display {
>
>                 <T extends HasValue<String> & HasBlurHandlers> T 
> getUsernameTextBox
> ();
>
>                 HasValue<String> getPasswordTextBox();
>
>                 HasValue<String> getErrorMessageBox();
>
>                 HasClickHandlers getLoginButton();
>         }
>
> // ...
>
> }
>
> While I can define a Display that returns a TextBox, I can't use the
> getUsernameTextBox without doing the assignment type inference against
> a concrete something implementing both interfaces in my presenter.
>
> How do you handle this?
>
> brgds,
>
> Papick
--~--~---------~--~----~------------~-------~--~----~
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