2011-10-02 19 views
5

Czy GWT 2.4 Wsparcie tym przypadku:GWT 2.4.0 RequestFactory polimorfizm

@Entity class MyBase {...} 
@Entity class MyChild1 extends MyBase {...} 
@Entity class MyChild2 extends MyBase {...} 
... 
@ProxyFor(MyBase.class) class MyBaseProxy extends EntityProxy {...} 
@ProxyFor(MyChild1.class) class MyChild1Proxy extends MyBaseProxy {...} 
@ProxyFor(MyChild2.class) class MyChild2Proxy extends MyBaseProxy {...} 
... 
@Service(ArticleBase.class) 
public interface MyBaseRequest extends RequestContext { 
    Request<MyBaseProxy> getStuff(); // MyChild1 here 
} 
... 
Request<MyBaseProxy> getStuffRequest = request.getStuff(); 
getStuffRequest.fire(new Receiver<MyBaseProxy>() { 
    @Override 
    public void onSuccess(MyBaseProxy proxy) { 
     button.setText(((MyChild1Proxy)proxy).getQwerty()); // HERE! 
    } 
}); 

?

Problem polega na tym, że nie mogę sprawić, żeby działało. Nie jest jeszcze obsługiwany lub muszę dodać gdzieś magiczną adnotację. Wszystko działa dobrze, gdy używam konkretnych typów, ale to nie działa, jeśli używam podstawowych.

Co myślisz?

Odpowiedz

10

Naprawiono go @ExtraTypes:

@Service(ArticleBase.class) 
@ExtraTypes({MyChild1Proxy.class, MyChild2Proxy.class}) 
public interface MyBaseRequest extends RequestContext { 
    Request<MyBaseProxy> getStuff(); // MyChild1 here 
} 
+0

dziękuję, zaoszczędziło mi dużo czasu - był coraz dziwne wyjątki przepełnienia stosu. Oczekiwano umieszczenia dodatkowej adnotacji na podstawowej klasie proxy (spowodowało to wyjątki przepełnienia stosu) ... –