2011-09-01 26 views
5

Bir kullanıcının gerçekleştirdiği bir arama hakkında bazı temel bilgileri içeren bir ValueProxy oluşturmaya çalışıyorum. Bazı nedenlerden dolayı GWT bir EntityProxy olmasını istiyor ancak neden görmediğimi (bu sınıfın bir EntityProxy olması mantıklı değil) görmüyorum.Bir ValueProxy oluşturulamıyor

java.lang.AssertionError: com.schedgy.trip.dao.filter.trip.proxy.DayFilterProxy is not an EntityProxy type 
    at com.google.web.bindery.requestfactory.shared.impl.IdFactory.asEntityProxy(IdFactory.java:66) 
    at com.google.web.bindery.requestfactory.shared.impl.IdFactory.createId(IdFactory.java:229) 
    at com.google.web.bindery.requestfactory.shared.impl.IdFactory.allocateId(IdFactory.java:41) 
    at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.create(AbstractRequestContext.java:478) 
    at com.schedgy.trip.client.activity.TripsActivity.getFilters(TripsActivity.java:56) 

Herhangi fikirler:

// Request is a TripRequest 
DayFilterProxy filter = request.create(DayFilterProxy.class); 

Bu sonuçlanır: sunucuya bu geri gönderiyor faaliyeti içinde

// FilterProxy extends ValueProxy 
@ProxyFor(DayFilter.class) 
public interface DayFilterProxy extends FilterProxy { 

    void setFilterValue(Date day); 
    Date getFilterValue(); 
} 

public class DayFilter extends Filter { 

    public DayFilter() { 
     setOperator(FilterOperator.GREATER_THAN_OR_EQUAL); 
     setField("dateRequested"); 
    } 

    public void setFilterValue(Date date) { 
     this.value = date; 
    } 

    public Date getFilterValue() { 
     return value; 
    } 
} 

public interface PaginationRequest<T> extends RequestContext { 

    Request<List<T>> paginate(int offset, int limit, String sortColumn, 
      boolean isSortAscending, List<FilterProxy> filters); 

    Request<Integer> count(List<FilterProxy> filters); 
} 

@Service(value=TripService.class, locator=SchedgyServiceLocator.class) 
public interface TripRequest extends PaginationRequest<TripProxy> { 

    Request<TripProxy> save(TripProxy trip); 
} 

? Kodunda başka bir yerde çalışan ValueProxy'lere sahip olduğumdan, sadece baktığım açık bir şey olmalı.

cevap

10

DayFilterProxy'nizin RequestContext dosyasından hiç referans alınamaması olabilir mi?

+0

Evet, sanırım bu durum böyle. Sadece RequestContext'te temel FilterProxy türüne başvuruyorum. GWT 2.4 ile istek fabrikada polimorfik param olabileceğini düşündüm. – Brad

+5

Onlara başvuran bir '@ ExtraTypes 'ek açıklaması eklemeniz gerekir: http://code.google.com/p/google-web-toolkit/wiki/RequestFactory_2_4#Polymorphism_support –

+0

Awesome! Teşekkürler! – Brad

İlgili konular